I'm trying to add a unittest attribute to an object in Python
class Boy:
def run(self, args):
print("Hello")
class BoyTest(unittest.TestCase)
def test(self)
self.assertEqual('2' , '2')
def self_test():
suite = unittest.TestSuite()
loader = unittest.TestLoader()
suite.addTest(loader.loadTestsFromTestCase(Boy.BoyTest))
return suite
However, I keep getting "AttributeError: class Boy has no attribute 'BoyTest'"
whenever I call self_test()
. Why?