[Python] setup method in unittest
unittest
setUp, tearDown - instance method
setUpClass, tearDownClass - class method
All instance of TestClass will only call setUpClass, tearDownClass once
Every instance of TestClass will call setUp, tearDown
django
setUpTestData - class method
All instance of TestClass will only call setUpTestData once
---
Three kinds of method in Python
instance method - must have self as a parameter
static method (@staticmethod) - no self, no need to access class-specific data
class method (@classmethod) - need cls as a parameter, need to access class-specific data