0

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.

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.