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 Be Assertive Quantitative Assertions

Gilang Ilhami
Gilang Ilhami
12,045 Points

Only 4 steps had been run

I'm not really worry about this, but i just want to know why

treehouse:~/workspace/rps$ python test.py                                             
....                                                                                  
----------------------------------------------------------------------                
Ran 4 tests in 0.001s                                                                 

OK                                                                                    

Codes:

import unittest
import moves

class MoveTests(unittest.TestCase):

    def setUp(self):
        self.rock = moves.Rock()
        self.paper = moves.Paper()
        self.scissors = moves.Scissors()

    def five_plus_five(self):
        assert 5 + 5 == 10

    def one_plus_one(self):
        assert not 1 + 1 == 3

    def test_equal(self):
        self.assertEqual(self.rock, moves.Rock())

    def test_not_equal(self):
        self.assertNotEqual(self.rock, self.paper)

    def test_rock_better_than_scissors(self):
        self.assertGreater(self.rock, self.scissors)

    def test_paper_worse_than_scissors(self):
        self.assertLess(self.paper, self.scissors)

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

1 Answer

Remember, every single test method MUST Start with the word test.

There are two tests you created that didn't start with test_.

I hope this makes sense. If it doesn't please reply below :)

Good luck! ~Alex

Gilang Ilhami
Gilang Ilhami
12,045 Points

Alex, a very big help you are. Thank you :)