Ejemplo n.º 1
0
    def test__equals__shouldReturnFalse__whenNameIsDifferent(self):
        # Arrange
        location_a = Location(anon_string())
        location_b = Location(anon_string())

        # Act
        actual = (location_a == location_b)
        # Assert
        self.assertFalse(actual)
Ejemplo n.º 2
0
    def test__equals__shouldReturnTrue__whenNameIsSame(self):
        # Arrange
        name = anon_string()
        location_a = Location(name)
        location_b = Location(name)

        # Act
        actual = (location_a == location_b)
        # Assert
        self.assertTrue(actual)
Ejemplo n.º 3
0
    def test__hash__shouldReturnDifferentHash__whenNameIsDifferent(self):
        # Arrange
        location_a = Location(anon_string())
        location_b = Location(anon_string())

        # Act
        hash_a = location_a
        hash_b = location_b

        # Assert
        self.assertNotEqual(hash_a, hash_b)
Ejemplo n.º 4
0
    def test__hash__shouldReturnSameHash__whenNameIsSame(self):
        # Arrange
        name = anon_string()
        location_a = Location(name)
        location_b = Location(name)

        # Act
        hash_a = location_a
        hash_b = location_b

        # Assert
        self.assertEqual(hash_a, hash_b)
Ejemplo n.º 5
0
    def test__str__shouldReturnLocationName(self):
        # Arrange
        expected_name = anon_string()
        location = Location(expected_name)

        # Act
        actual = str(location)

        # Assert
        self.assertEquals(expected_name, actual)
Ejemplo n.º 6
0
    def test__name__shouldReturnName__whenAccessing(self):
        # Arrange
        expected_name = anon_string()
        location = Location(expected_name)

        # Act
        name = location.name

        # Assert
        self.assertEqual(expected_name, name)
Ejemplo n.º 7
0
    def test__repr__shouldReturnRepresentation(self):
        # Arrange
        name = anon_string()
        location = Location(name)
        expected = "%s(\"%s\")" % (Location.__name__, name)

        # Act
        actual = repr(location)

        # Assert
        self.assertEquals(expected, actual)
Ejemplo n.º 8
0
 def action():
     Location("")
Ejemplo n.º 9
0
 def action_list():
     Location([])
Ejemplo n.º 10
0
 def action_set():
     Location(set())
Ejemplo n.º 11
0
 def action_int():
     Location(42)
Ejemplo n.º 12
0
 def action_none():
     Location(None)
Ejemplo n.º 13
0
def anon_location() -> Location:
    return Location(anon_string())