Changeset 125:12be9632fa15


Ignore:
Timestamp:
Sep 2, 2013, 2:57:31 PM (7 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Message:

Better tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/tests/test_game_object.py

    r124 r125  
    4444        return puzzler
    4545
     46    def assert_floor_switch(self, expected, shapes):
     47        gobj = FakeGameObject(None, FakeSpace(*shapes))
     48        puzzler = self.mkpuzzler(gobj, game_object.FloorSwitchPuzzler)
     49        self.assertEqual(expected, puzzler.get_state())
     50
    4651    def test_floor_switch_puzzler(self):
    47         gobj = FakeGameObject(None, FakeSpace())
    48         puzzler = self.mkpuzzler(gobj, game_object.FloorSwitchPuzzler)
    49         self.assertFalse(puzzler.get_state())
    50 
    51         gobj = FakeGameObject(None, FakeSpace(FakeShape()))
    52         puzzler = self.mkpuzzler(gobj, game_object.FloorSwitchPuzzler)
    53         self.assertFalse(puzzler.get_state())
     52        self.assert_floor_switch(False, [])
     53        self.assert_floor_switch(False, [FakeShape()])
    5454
    5555        for collision_type in SWITCH_PUSHERS:
    56             gobj = FakeGameObject(
    57                 None, FakeSpace(FakeShape(collision_type)))
    58             puzzler = self.mkpuzzler(gobj, game_object.FloorSwitchPuzzler)
    59             self.assertTrue(puzzler.get_state())
     56            self.assert_floor_switch(True, [FakeShape(collision_type)])
     57            self.assert_floor_switch(
     58                True, [FakeShape(), FakeShape(collision_type)])
    6059
    6160    def test_state_proxy_puzzler(self):
Note: See TracChangeset for help on using the changeset viewer.