Class method setUpClass should have 'cls' as first argument
25
26class TestConnection(unittest.TestCase):
27 @classmethod
28 def setUpClass(self): 29 self.table = sqlalchemy.Table(
30 'tests_users', lore.io.main.metadata,
31 sqlalchemy.Column('id', sqlalchemy.Integer, primary_key=True),
Description
It is recommended to name the first argument of a classmethod as cls
so that it's easy to differentiate them from regular instance methods.
Bad practice
class SpaceShip:
@classmethod
def trajectory(self, x, y, z): # `self` here can be very confusing
...
Recommended
class SpaceShip:
@classmethod
def trajectory(cls, x, y, z):
...