def test_map_two_points():
    p1 = Point("res", 23.342, 25.235)
    p2 = Point("tes", 23.533, 12.533)
    map_obj = Map()
    map_obj.maps = p1
    map_obj.maps = p2
    assert map_obj.maps == [p1, p2]
def test_invalid_point_generation():
    with pytest.raises(ValueError) as exp:
        Point("Paris", 14.4534, -555.8906)
        assert str(exp.value) == "Invalid latitude, longitude combination"

    with pytest.raises(TypeError) as exp:
        Point(123, 14.4534, -34.8906)
    assert str(exp.value) == "City name provided must be string type"
Example #3
0
def test_invalid_point_generation():
    with pytest.raises(ValueError) as exp:
        Point("Buenos Aires", 99.11286, -189.08268)
    assert str(exp.value) == "Invalid latitude, longitude combination"

    with pytest.raises(ValueError) as exp:
        Point(1234, 12.11286, -55.08268)
    assert str(exp.value) == "City name provided must be a string"
def test_invalid_maps_point():
    p1 = Point("tess", 23.535, 34.233)
    p2 = Point("tere", 22.234, 12.445)
    map_obj = Map()
    map_obj.maps = p1
    assert map_obj.is_point_present(p1)
    with pytest.raises(Exception) as exp:
        map_obj.is_point_present(p2)
    assert str(exp.value) == "Point not found"
Example #5
0
def test_invalid_point_generation():  # TO DO
    with pytest.raises(ValueError) as exp:
        Point('Buenos Aires', 12.11386, -555.08269)
    assert (str(
        exp.value
    ) == 'latitude int should be between -90 to 90 longitude value should be'
            ' between -180 to 180')
Example #6
0
def test_make_one_point():
    p1 = Point("Dakar", 14.7167, 17.4677)
    assert p1.get_lat_long() == (14.7167, 17.4677)
Example #7
0
def test_invalid_point_generation():  # TO DO
    with pytest.raises(ValueError) as exp:
        Point("X", 12.111, -555)
    assert str(exp.value) == 'Invalid latitude and longitude combination'
Example #8
0
def test_invalid_city_name():
    with pytest.raises(ValueError) as exp:
        Point(123, 10, 10)
    assert str(exp.value) == 'City name must be a string'
Example #9
0
def test_invalid_point_generation():  # TO DO
    # with pytest.raises(Exception) as exp:
    with pytest.raises(ValueError) as exp:
        Point("Buenos Aires", 17.1234, -555.01234)
    assert str(exp.value) == 'Invalid latitude or longitude combination'
def test_invalid_point_city_name():
    with pytest.raises(ValueError) as exp:
        Point(4, 33.322, 23.332)
    assert str(exp.value) == "Invalid city name type"
def test_invalid_point_generation():
    with pytest.raises(ValueError) as exp:
        Point("Sofia", 12.11386, -555.08262)
    assert str(exp.value) == "Invalid latitude, longitude combination"
Example #12
0
def test_invalid_point_generation():
    with pytest.raises(ValueError) as exp:
        Point("Buenos Aires", 12.11386, -555.08269)
    assert str(exp.value) == "Invalid combination"
Example #13
0
def test_invalid_city_name_data_type():
    with pytest.raises(ValueError) as exp:
        Point(name=123, latitude=45.12345, longitude=-125.32145)
    assert str(exp.value) == 'City name must be a string'
def test_invalid_point_generation():
    with pytest.raises(Exception) as exp:
        Point("Buenos Aries", 12.11386, -555.08269)
    assert str(exp.value) == 'Invalid Latitude or Longitude'