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 trialY B
14,136 PointsUnit 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?
import unittest
class SimpleTestCase(unittest.TestCase):
def little_test(self):
assert 10-10 == 0
4 Answers
Dan Johnson
40,533 Pointsunittest only recognizes tests prefixed with "test_" so you'll need to reverse the name:
def test_little(self):
Annie Scott
27,613 Pointscorret answer
import unittest
class SimpleTestCase(unittest.TestCase): def test_10_minus_10(self): assert 10-10 == 0
Y B
14,136 PointsThanks - I forgot that bit
Annie Scott
27,613 Pointsimport unittest class SimpleTestCase(unittest.TestCase): def SimpleTestCase_10_minus_10(self): assert 10-10 == 0
Y B
14,136 PointsY B
14,136 Pointsthe 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"