コード例 #1
0
    def test_default_sequence(self):
        square = Square()

        square.construct_platform()
        square.bring_crowd()
        square.invite_speaker()

        square.speaker_talk()
        square.make_noise()
        self.assertNotEqual(square.arthur.state, "flying")
        square.make_noise()

        # at this point Arthur should be flying
        self.assertEqual(square.arthur.state, "flying")
コード例 #2
0
    def test_crowd_invites_speaker(self):
        ''' Just another way to make Arthur fly

        Crowd comes makes some noise, platform is getting build, they invite
        speaker and one more noise -- Arthur is flying
        '''
        square = Square()
        square.bring_crowd()
        square.make_noise()
        square.construct_platform()
        square.invite_speaker()
        square.speaker_talk()
        self.assertNotEqual(square.arthur.state, "flying")
        square.make_noise()
        self.assertEqual(square.arthur.state, "flying")
コード例 #3
0
    def test_noise_on_unprepared_square(self):
        ''' People make noise in the square, nothing else is set

        This test aims to check if Arthur is going to fly without platform
        and speaker being on their places (he should not)
        '''
        square = Square()

        crowd = square.bring_crowd()

        square.make_noise()
        square.make_noise()

        self.assertNotEqual(square.arthur.state, "flying")
コード例 #4
0
    def test_noise_on_square_without_speaker(self):
        ''' People make noise in the square, nothing else is set

        Modification of the previous tests which aims to check if Arthur will
        be flying in the absence of speaker.
        '''
        square = Square()

        crowd = square.bring_crowd()

        square.make_noise()
        square.make_noise()

        self.assertNotEqual(square.arthur.state, "flying")
コード例 #5
0
 def test_bringing_crowd_again(self):
     square = Square()
     square.bring_crowd()
     self.assertRaises(RuntimeError, square.bring_crowd)
コード例 #6
0
 def test_bringing_crowd(self):
     square = Square()
     crowd = square.bring_crowd()
     self.assertIsNotNone(crowd)