Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tests/test_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def test_geonames_query():
place_type = "city"

coordinates = resolver.resolve(place_name, country_code, place_type)
assert coordinates[0] is not None, "Coordinates should not be None"
assert isinstance(coordinates, tuple), "Coordinates should be a tuple"
assert len(coordinates) == 2, "Coordinates should contain latitude and longitude"
assert coordinates is not None, "1. Coordinates should not be None"
assert isinstance(coordinates, dict), "2. Coordinates should be a dict"
assert "latitude" in coordinates and "longitude" in coordinates, "3. Coordinates should contain latitude and longitude"
assert coordinates["latitude"] == 40.71427 and coordinates["longitude"] == -74.00597, f"4. Coordinates {coordinates} do not match expected values for New York, US"
Comment on lines +18 to +21
Copy link

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The explicit None check may be redundant as subsequent assertions will fail on None; consider removing it to simplify the test.

Suggested change
assert coordinates is not None, "1. Coordinates should not be None"
assert isinstance(coordinates, dict), "2. Coordinates should be a dict"
assert "latitude" in coordinates and "longitude" in coordinates, "3. Coordinates should contain latitude and longitude"
assert coordinates["latitude"] == 40.71427 and coordinates["longitude"] == -74.00597, f"4. Coordinates {coordinates} do not match expected values for New York, US"
assert isinstance(coordinates, dict), "1. Coordinates should be a dict"
assert "latitude" in coordinates and "longitude" in coordinates, "2. Coordinates should contain latitude and longitude"
assert coordinates["latitude"] == 40.71427 and coordinates["longitude"] == -74.00597, f"3. Coordinates {coordinates} do not match expected values for New York, US"

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly comparing floats can lead to flaky tests; consider using pytest.approx for approximate comparisons of latitude and longitude values.

Copilot uses AI. Check for mistakes.