Skip to content

Commit 109cbcb

Browse files
author
esocode
committed
Update tests and readme file.
1 parent fa9a72e commit 109cbcb

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ You can also retrieve location details using latitude and longitude.
3434
from geodb_finder import search_by_coordinates
3535

3636
# Search by latitude and longitude
37-
result = search_by_coordinates("51.5074", "-0.1278") # London coordinates
37+
result = search_by_coordinates("52n22", "6e27") # Example coordinates
3838
print(result) # Returns a dictionary with city, latitude, longitude, timezone, and country
3939
```
4040

41-
**Note:** An asynchronous version of this function is available as `search_by_coordinates_async(latitude: str, longitude: str)`.
41+
**Note:** An asynchronous version of this function is available as `search_by_coordinates_async(latitude: str, longitude: str)`, and it follows the same coordinate format.
4242

4343
### List Available Countries
4444

tests/test_package.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from geodb_finder import search_location, search_location_async, list_countries, list_countries_async
2+
from geodb_finder import search_location, search_location_async, list_countries, list_countries_async, search_by_coordinates, search_by_coordinates_async
33

44
def test_sync_search():
55
# Test synchronous search
@@ -19,6 +19,17 @@ def test_sync_search():
1919
assert result["city"] == "London"
2020
assert result["country"] == "United Kingdom"
2121

22+
def test_search_by_coordinates():
23+
# Test synchronous search by coordinates
24+
result = search_by_coordinates("52n22", "4e54") # Amsterdam coordinates
25+
print("Sync search by coordinates result:", result)
26+
assert result is not None
27+
assert result["city"] == "Amsterdam"
28+
assert result["country"] == "Netherlands"
29+
assert "longitude" in result
30+
assert "latitude" in result
31+
assert "timezone" in result
32+
2233
def test_list_countries():
2334
# Test synchronous list_countries
2435
countries = list_countries()
@@ -36,7 +47,16 @@ async def test_list_countries_async():
3647
assert len(countries) > 0
3748
assert "Netherlands" in countries # Example check
3849

39-
# Test asynchronous search
50+
# Test asynchronous search by coordinates
51+
result = await search_by_coordinates_async("52n22", "4e54") # Amsterdam coordinates
52+
print("Async search by coordinates result:", result)
53+
assert result is not None
54+
assert result["city"] == "Amsterdam"
55+
assert result["country"] == "Netherlands"
56+
assert "longitude" in result
57+
assert "latitude" in result
58+
assert "timezone" in result
59+
4060
result = await search_location_async("Amsterdam")
4161
print("Async search result:", result)
4262
assert result is not None

0 commit comments

Comments
 (0)