I understood that staticmethod should always be referred to by the classname in which they belong. But I see that they can also be accessed by the keyword self too.
This is bit confusing and I don't see interpreter throwing an error.
import unittest
class TestA(unittest.TestCase):
@staticmethod
def fun1():
return True
@staticmethod
def fun2():
return False
def test_one(self):
assert TestA.fun1() == True
def test_two(self):
assert self.fun2() == False
if __name__ == '__main__':
unittest.main()
What is the right way to access the staticmethod. Like TestA.fun1 above which is clear to me or as self.fun2 which is mildly concerning because there is no instance sent to fun2.