i have python code contains unit tests below:
class suncalctestcases(unittest.testcase): """tests `suncalc.py`.""" def near(val1, val2): return abs(val1 - val2) < (margin or 1e-15) def test_getpositions(self): """get sun positions correctly""" sunpos = suncalc.getposition(self.date, self.lat, self.lng) az = sunpos["azimuth"] res = self.near(az, -2.5003175907168385) but when run error:
traceback (most recent call last): file "test.py", line 64, in test_getpositions res = self.near(az, -2.5003175907168385) typeerror: near() takes 2 arguments (3 given) i new python apologize if missing here, far can tell passing in 2 parameters when call function: self.near(az, -2.5003175907168385)
can tell me why thinks i'm passing in 3 parameters?
you forgot pass self in near function
def near(self, val1, val2):
meaning of @classmethod , @staticmethod beginner?
what difference between @staticmethod , @classmethod in python?
Comments
Post a Comment