Django TestCase Comedy

Here's a little snippet that'll entertain the vast throngs of people who are interested in both Rock Paper Scissors strategy and Django unit testing.

def test_desperate_futility_of_avalanche(self):
        for futile_attempt in range(100):
            Round.objects.create(game=self.normal_game,
                                 initiator_choice=self.rock,
                                 opponent_choice=self.rock)
        self.failUnlessEqual(self.normal_game.result(), UNRESOLVED)

For the uninitiated:

1 thought on “Django TestCase Comedy”

Leave a Reply

Your email address will not be published. Required fields are marked *