views:

54

answers:

1

What am I doing wrong here?

import unittest

class Test_1(unittest.TestCase):

    def SetUp(self):
        self.data = []

    def test_data(self):
        self.assertEqual(len(self.data),0)

if __name__=='__main__':
    unittest.main()

When I run it, it says:

Traceback (most recent call last):
File "C:...\break_unit_test.py", line 9 , in test_data self.assertEqual(len(self.data),0) AttributeError: 'Test_1' object has no attribute 'data'

I'm trying to follow this example.

+4  A: 

It must be named setUp, starting with a lowercase s.

Alex Martelli