Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Testing Be Assertive Quantitative Assertions

26,613 Points

What is Rock() calling on within the self.assertEqual method? [SOLVED]

I'm not quite understanding the mechanics of the following class:

class MoveTests(unittest.TestCase):
    def setUp(self):
        self.rock = moves.Rock()
        self.paper = moves.Paper()
        self.scissors = moves.Scissors()

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

The setUp method defines self.rock so it makes sense that in self.assertEqual method he first calls on the self.rock, what does the second Rock() function call on, and how does it create a new instance of self.rock to compare itself with?

I'm just thinking how does Rock() work without calling moves.Rock()?


nevermind... he calls moves.Rock() after. Should have finished watching the video instead. -_-