Windows XP Python 2.7
I'm following the code in Beginning Python book and have two files in a folder called testing. I'm trying to get it to fail but it wont even run the tests.The first file my_math.py is just a dummy product function
def product(x, y):
pass
The second is the test test_my_math.py
import unittest, my_math
class ProductTestCase(unittest.TestCase):
def testIntegers(self):
for x in xrange(-10, 10):
for y in xrange(-10, 10):
p = my_math.product(x, y)
self.failUnless(p == x*y, 'Integer multiplication failed')
def testFloats(self):
for x in xrange(-10, 10):
for y in xrange(-10, 10):
x = x/10.0
y = y/10.0
p = my_math.product(x, y)
self.failUnless(p == x*y, 'Float multiplicaton failed')
if __name__ == '__main__': unittest.main()
When I run the test in the command line
C:\Python27\Example_Programs\testing>python test_my_math.py
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
C:\Python27\Example_Programs\testing>
if __name__test is a posting error?