Skip to content

Commit

Permalink
chg: Sync with upstream
Browse files Browse the repository at this point in the history
Signed-off-by: Raphaël Vinot <[email protected]>
  • Loading branch information
Rafiot committed Dec 3, 2024
1 parent 8ec92e8 commit 39616e9
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions tests/test_asyncio/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2490,7 +2490,7 @@ async def test_old_geopos_no_value(self, r: valkey.asyncio.Valkey[str]):
assert await r.geopos("barcelona", "place1", "place2") == []

@skip_if_server_version_lt("6.2.0")
async def test_geosearch(self, r: valkey.Valkey):
async def test_geosearch(self, r: valkey.asyncio.Valkey[str]):
values = (
(2.1909389952632, 41.433791470673, "place1")
+ (2.1873744593677, 41.406342043777, b"\x80place2")
Expand Down Expand Up @@ -2518,13 +2518,13 @@ async def test_geosearch(self, r: valkey.Valkey):
"barcelona", member="place3", radius=100, unit="km", count=2
) == [b"place3", b"\x80place2"]
search_res = await r.geosearch(
"barcelona", member="place3", radius=100, unit="km", count=1, any=1
"barcelona", member="place3", radius=100, unit="km", count=1, any=True
)
assert search_res[0] in [b"place1", b"place3", b"\x80place2"]

@skip_unless_arch_bits(64)
@skip_if_server_version_lt("6.2.0")
async def test_geosearch_member(self, r: valkey.Valkey):
async def test_geosearch_member(self, r: valkey.asyncio.Valkey[str]):
values = (2.1909389952632, 41.433791470673, "place1") + (
2.1873744593677,
41.406342043777,
Expand Down Expand Up @@ -2562,7 +2562,7 @@ async def test_geosearch_member(self, r: valkey.Valkey):
)

@skip_if_server_version_lt("6.2.0")
async def test_geosearch_sort(self, r: valkey.Valkey):
async def test_geosearch_sort(self, r: valkey.asyncio.Valkey[str]):
values = (2.1909389952632, 41.433791470673, "place1") + (
2.1873744593677,
41.406342043777,
Expand Down Expand Up @@ -2601,9 +2601,9 @@ async def test_geosearch_sort(self, r: valkey.Valkey):
)
async def test_geosearch_with(
self,
r: valkey.Valkey,
geosearch_kwargs: Dict[str, Any],
expected_geosearch_result: List[Any],
r: valkey.asyncio.Valkey[str],
geosearch_kwargs: dict[str, Any],
expected_geosearch_result: list[Any],
):
values = (2.1909389952632, 41.433791470673, "place1") + (
2.1873744593677,
Expand Down Expand Up @@ -2644,7 +2644,7 @@ async def test_geosearch_with(
)

@skip_if_server_version_lt("6.2.0")
async def test_geosearch_negative(self, r: valkey.Valkey):
async def test_geosearch_negative(self, r: valkey.asyncio.Valkey[str]):
# not specifying member nor longitude and latitude
with pytest.raises(exceptions.DataError):
assert await r.geosearch("barcelona")
Expand Down Expand Up @@ -2687,11 +2687,11 @@ async def test_geosearch_negative(self, r: valkey.Valkey):

# use any without count
with pytest.raises(exceptions.DataError):
assert await r.geosearch("barcelona", member="place3", radius=100, any=1)
assert await r.geosearch("barcelona", member="place3", radius=100, any=True)

@pytest.mark.onlynoncluster
@skip_if_server_version_lt("6.2.0")
async def test_geosearchstore(self, r: valkey.Valkey):
async def test_geosearchstore(self, r: valkey.asyncio.Valkey[bytes]):
values = (2.1909389952632, 41.433791470673, "place1") + (
2.1873744593677,
41.406342043777,
Expand All @@ -2711,7 +2711,7 @@ async def test_geosearchstore(self, r: valkey.Valkey):
@pytest.mark.onlynoncluster
@skip_unless_arch_bits(64)
@skip_if_server_version_lt("6.2.0")
async def test_geosearchstore_dist(self, r: valkey.Valkey):
async def test_geosearchstore_dist(self, r: valkey.asyncio.Valkey[str]):
values = (2.1909389952632, 41.433791470673, "place1") + (
2.1873744593677,
41.406342043777,
Expand All @@ -2729,6 +2729,7 @@ async def test_geosearchstore_dist(self, r: valkey.Valkey):
)
# instead of save the geo score, the distance is saved.
score = await r.zscore("places_barcelona", "place1")
assert score is not None
assert math.isclose(score, 88.05060698409301)

@skip_if_server_version_lt("3.2.0")
Expand Down

0 comments on commit 39616e9

Please sign in to comment.