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

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. -_-