def test_creature_accessor(self): """Test that the creatures can be accessed via their uid.""" bg = BattlegroundStateFactory() h1 = bg.normalize() uid = bg.add_creature(CreatureStateFactory()) bg[uid].tap() self.assertNotEqual(bg.normalize(), h1)
def test_serialization(self): """Test repr and from_string methods together.""" for s in self.SERIALIZATION_FIXTURES: self.assertEqual(repr(BattlegroundState.from_string(s)), s, 'Invalid deserialize & serialize transformation') for _ in range(10): state = BattlegroundStateFactory.build_with_creatures(9) s = repr(state) self.assertEqual(repr(BattlegroundState.from_string(s)), s, 'Invalid deserialize & serialize transformation')
def test_get_creatures(self): bg = BattlegroundStateFactory.build_with_creatures(9) self.assertEqual(len(bg.creatures), 9) self.assertEqual(len(bg.get_creatures(0)) + len(bg.get_creatures(1)), 9)
def test_get_creatures(self): bg = BattlegroundStateFactory.build_with_creatures(9) self.assertEqual(len(bg.creatures), 9) self.assertEqual( len(bg.get_creatures(0)) + len(bg.get_creatures(1)), 9)