Friday, March 06, 2020

Why doesn't unittest.main() run my function?

 You've got :

import unittest
from myFns import *

class Test_myFnsunittest.TestCase ) :

    def Test_myFn1self ) :
        testcase = {'a' : 1}
        expected = 1
        self.assertEqual( myFn1(testcase), expected )

unittest.main()

And, when you run, nothing happens..  Why? Coz you have to start each test function name with "test", you can't have something else :) Wouldn't a warning be nice though? :)


No comments: