Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Testing First Steps With Testing Simple Unit Test

Siddhartha Kala
Siddhartha Kala
4,170 Points

Getting error - It looks like Task 1 is no longer passing

I dont understand why I am getting this error. I am still importing unittest properly as required in Task 1. Maybe some syntax error, but, I am unable to find it.

tests.py
import unittest

class TestUM(unittest.TestCase):

    def test_SimpleTestCase(self):
        assert 10-10 = 0

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

1 Answer

Steven Parker
Steven Parker
229,644 Points

That message can be misleading and generally is caused by introducing a syntax error, which invalidates the re-validation of the earlier task(s).

In this case, the syntax error is caused by the symbol being used to compare terms in the "assert" statement: A single "=" is an assignment, the equality comparison operator is "==".

Also, the challenge only asks you to define the test, you don't need to add code to run it. The extra code will also confuse the validation.

Siddhartha Kala
Siddhartha Kala
4,170 Points

Thanks a lot. Thats very helpful :). I totally missed to see the single = sign even after checking the code 10s of times.