4class Test_TestAPI(unittest.TestCase):
5
6 @classmethod
7 def setUpClass(self): 8 self.conn = http.client.HTTPConnection("localhost:3000")
9
10
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.
class SpaceShip:
@classmethod
def trajectory(self, x, y, z): # `self` here can be very confusing
...
class SpaceShip:
@classmethod
def trajectory(cls, x, y, z):
...