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')
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)
def test_export(self): treasure = TreasureField() self.assertEqual(treasure.export(), {FIELD_KEY: Field.TREASURE}, "Treasure field export")
def test_export(self): treasure = TreasureField() self.assertEqual(treasure.export(), {FIELD_KEY: Field.TREASURE}, 'Treasure field export')
def test_export(self): treasure = TreasureField() self.assertEqual(treasure.export(), Field.TREASURE, 'Treasure field export')