Example #1
0
    def test__equals__shouldReturnFalse__whenUPIDIsDifferentAndNameIsDifferent(
            self):
        # Arrange
        player_a = Player(anon_string(), anon_upid())
        player_b = Player(anon_string(), anon_upid())

        # Act
        actual = (player_a == player_b)

        # Assert
        self.assertFalse(actual)
Example #2
0
    def test__hash__shouldReturnDifferentHash__whenUPIDIsDifferent(self):
        # Arrange
        name = anon_string()
        player_a = Player(name, anon_upid())
        player_b = Player(name, anon_upid())

        # Act
        hash_a = hash(player_a)
        hash_b = hash(player_b)

        # Assert
        self.assertNotEqual(hash_a, hash_b)
Example #3
0
    def test__name__shouldReturnName_whenAccessing(self):
        # Arrange
        expected_name = "Test Name"
        player = Player(expected_name, anon_upid())

        # Act
        actual = player.name

        # Assert
        self.assertEqual(expected_name, actual)
Example #4
0
    def test__upid__shouldReturnUPID__whenConstructedWithStr(self):
        # Arrange
        expected_upid = anon_upid()
        player = Player(anon_string(), str(expected_upid))

        # Act
        actual = player.upid

        # Assert
        self.assertIsInstance(actual, UPID)
        self.assertEqual(expected_upid, actual)
Example #5
0
    def test__str__shouldReturnStringForm(self):
        # Arrange
        name = anon_string()
        expected_string = name
        player = Player(name, anon_upid())

        # Act
        actual = str(player)

        # Assert
        self.assertEqual(expected_string, actual)
Example #6
0
    def test__repr__shouldReturnRepresentation(self):
        # Arrange
        name = anon_string()
        upid = anon_upid()
        expected_string = "%s(\"%s\",%s)" % (Player.__name__, name, repr(upid))
        player = Player(name, upid)

        # Act
        actual = repr(player)

        # Assert
        self.assertEqual(expected_string, actual)
Example #7
0
    def test__hash__shouldReturnSameHash__whenUPIDIsSame(self):
        # Arrange
        upid = anon_upid()
        player_a = Player(anon_string(), upid)
        player_b = Player(anon_string(), upid)

        # Act
        hash_a = hash(player_a)
        hash_b = hash(player_b)

        # Assert
        self.assertEqual(hash_a, hash_b)
Example #8
0
    def test__equals__shouldReturnTrue__whenUPIDIsIdenticalAndNameIsDifferent(
            self):
        # Arrange
        upid = anon_upid()
        player_a = Player(anon_string(), upid)
        player_b = Player(anon_string(), upid)

        # Act
        actual = (player_a == player_b)

        # Assert
        self.assertTrue(actual)
Example #9
0
 def action():
     Player("", anon_upid())
Example #10
0
 def action_list():
     Player([], anon_upid())
Example #11
0
 def action_set():
     Player(set(), anon_upid())
Example #12
0
 def action_int():
     Player(42, anon_upid())
Example #13
0
 def action_none():
     Player(None, anon_upid())