Ejemplo n.º 1
0
    def test_equality(self):
        game_state1 = GameStateFactory.build_with_creatures(9)
        game_state2 = GameStateFactory.build_with_creatures(8)

        self.assertNotEqual(game_state1, game_state2)

        game_state2.battleground = game_state1.battleground
        self.assertEqual(game_state1, game_state2)

        game_state1 = GameState.from_string('20/20 (1/0): vs 1/2')
        game_state2 = GameState.from_string('20/20 (1/0): vs 1/2')
        self.assertEqual(game_state1, game_state2)
Ejemplo n.º 2
0
    def test_equality(self):
        game_state1 = GameStateFactory.build_with_creatures(9)
        game_state2 = GameStateFactory.build_with_creatures(8)

        self.assertNotEqual(game_state1, game_state2)

        game_state2.battleground = game_state1.battleground
        self.assertEqual(game_state1, game_state2)

        game_state1 = GameState.from_string("20/20 (1/0): vs 1/2")
        game_state2 = GameState.from_string("20/20 (1/0): vs 1/2")
        self.assertEqual(game_state1, game_state2)
Ejemplo n.º 3
0
 def test_serialization(self):
     for s in self.SERIALIZATION_FIXTURES:
         self.assertEqual(repr(GameState.from_string(s)), s, "Invalid deserialize & serialize transformation")
     for _ in range(10):
         game_state = GameStateFactory.build_with_creatures()
         s = repr(game_state)
         self.assertEqual(repr(GameState.from_string(s)), s, "Invalid deserialize & serialize transformation")
Ejemplo n.º 4
0
 def test_serialization(self):
     for s in self.SERIALIZATION_FIXTURES:
         self.assertEqual(repr(GameState.from_string(s)), s,
                          'Invalid deserialize & serialize transformation')
     for _ in range(10):
         game_state = GameStateFactory.build_with_creatures()
         s = repr(game_state)
         self.assertEqual(repr(GameState.from_string(s)), s,
                          'Invalid deserialize & serialize transformation')