コード例 #1
0
    def test_friendly_piece_exists(self):
        london = CoastalTerritory(self.state, 1, 'London', 'England', [], [])
        wales = CoastalTerritory(self.state, 2, 'Wales', 'England', [], [])
        paris = InlandTerritory(self.state, 3, 'Paris', 'France', [])

        Army(self.state, 0, 'England', london)
        Army(self.state, 0, 'France', wales)

        self.assertTrue(london.friendly_piece_exists('England'))
        self.assertFalse(wales.friendly_piece_exists('England'))
        self.assertFalse(paris.friendly_piece_exists('England'))
コード例 #2
0
    def test_friendly_piece_exists(self):
        london = CoastalTerritory(1, 'London', 'England', [], [])
        wales = CoastalTerritory(2, 'Wales', 'England', [], [])
        paris = InlandTerritory(3, 'Paris', 'France', [])
        self.state.register(london, wales, paris)

        army_london = Army('England', london)
        army_wales = Army('France', wales)
        self.state.register(army_london, army_wales)

        self.assertTrue(london.friendly_piece_exists('England'))
        self.assertFalse(wales.friendly_piece_exists('England'))
        self.assertFalse(paris.friendly_piece_exists('England'))