示例#1
0
 def test_init(self):
     with self.assertRaises(AssertionError):
         TreasureField(0.1)
     treasure = TreasureField()
     self.assertEqual(treasure.price, treasure.DEFAULT_TREASURE_PRICE, 'Default treasure price with empty init')
     treasure = TreasureField(2)
     self.assertEqual(treasure.price, 2, 'Default treasure price with given price')
示例#2
0
    def test_action_reach_treasure(self):
        game_map = Map(width=1, height=2)
        fake_map = [
            [TreasureField()],
            [BotField(Orientation.NORTH)],
        ]
        setattr(game_map, '_{}__map'.format(game_map.__class__.__name__), fake_map)
        game = Game(game_map)

        with self.assertRaises(GameFinished):
            game.action('bot_id', Action.STEP)
示例#3
0
 def test_export(self):
     treasure = TreasureField()
     self.assertEqual(treasure.export(), {FIELD_KEY: Field.TREASURE}, "Treasure field export")
示例#4
0
 def test_export(self):
     treasure = TreasureField()
     self.assertEqual(treasure.export(), {FIELD_KEY: Field.TREASURE}, 'Treasure field export')
示例#5
0
 def test_export(self):
     treasure = TreasureField()
     self.assertEqual(treasure.export(), Field.TREASURE, 'Treasure field export')