Пример #1
0
 def test_add_new(self):
     Entity.erase_all_entities()
     an_NPC = self.new_NPC()
     a_player = self.new_player()
     a_thing = self.new_thing()
     self.assertEquals(Entity.all_NPCs, [an_NPC])
     self.assertEquals(Entity.player, a_player)
     self.assertEquals(Entity.all_things, [a_thing])
     Entity.erase_all_entities()
Пример #2
0
 def test_reset(self):
     """
     1. create a new NPC, player, thing, 2.reset Entity class, 3. check if there is any entity stored in Entity
     """
     self.new_NPC()
     self.new_player()
     self.new_thing()
     Entity.erase_all_entities()
     self.assertEquals(Entity.all_NPCs, [])
     self.assertEquals(Entity.player, None)
     self.assertEquals(Entity.all_things, [])
Пример #3
0
 def test_remove_old(self):
     Entity.erase_all_entities()
     # add and remove an NPC
     an_NPC = self.new_NPC()
     self.assertNotEquals(Entity.all_NPCs, [])
     Entity.remove_old(an_NPC)
     self.assertEquals(Entity.all_NPCs, [])
     # add and remove a player
     a_player = self.new_player()
     self.assertNotEquals(Entity.player, None)
     Entity.remove_old(a_player)
     self.assertEquals(Entity.player, None)
     # add and remove an thing
     a_thing = self.new_thing()
     self.assertNotEquals(Entity.all_things, [])
     Entity.remove_old(a_thing)
     self.assertEquals(Entity.all_things, [])