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

Y B
Y B
14,136 Points

Unit test challenge failed

For some reason this unit test failed to pass the challenge It asked for one that tested 10-10 is 0 but seems to say that it can't find the expected tests. No idea why?

tests.py
import unittest


class SimpleTestCase(unittest.TestCase):
    def little_test(self):
        assert 10-10 == 0
Y B
Y B
14,136 Points

the exact wording of the challenge is: "Create a TestCase named SimpleTestCase with a simple test that asserts that 10 - 10 is 0." and the response is: " Bummer! Didn't find the expected tests"

4 Answers

Dan Johnson
Dan Johnson
40,532 Points

unittest only recognizes tests prefixed with "test_" so you'll need to reverse the name:

def test_little(self):

corret answer

import unittest

class SimpleTestCase(unittest.TestCase): def test_10_minus_10(self): assert 10-10 == 0

Y B
Y B
14,136 Points

Thanks - I forgot that bit

import unittest class SimpleTestCase(unittest.TestCase): def SimpleTestCase_10_minus_10(self): assert 10-10 == 0