Skip to content

Commit b900232

Browse files
committed
applying review comments
1 parent a24b9c2 commit b900232

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

redis/commands/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,10 +2059,10 @@ def msetex(
20592059
20602060
``px`` sets an expire flag on the keys in ``mapping`` for ``px`` milliseconds.
20612061
2062-
``exat`` sets an expire flag on the keys in ``mapping`` for ``ex`` seconds,
2062+
``exat`` sets an expire flag on the keys in ``mapping`` for ``exat`` seconds,
20632063
specified in unix time.
20642064
2065-
``pxat`` sets an expire flag on the keys in ``mapping`` for ``ex`` milliseconds,
2065+
``pxat`` sets an expire flag on the keys in ``mapping`` for ``pxat`` milliseconds,
20662066
specified in unix time.
20672067
20682068
``keepttl`` if True, retain the time to live associated with the keys.

tests/test_asyncio/test_commands.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,15 +1244,15 @@ async def test_msetex_expiration_ex_and_keepttl_with_cluster_client(self, r):
12441244
)
12451245
== 1
12461246
)
1247-
ttls = [await r.ttl(key) for key in all_test_keys]
1247+
ttls = await asyncio.gather(*[r.ttl(key) for key in all_test_keys])
12481248
for ttl in ttls:
12491249
assert pytest.approx(ttl) == 10
12501250

12511251
assert await r.mget(*all_test_keys) == [b"1", b"2"]
12521252
await asyncio.sleep(1.1)
12531253
# validate keepttl
12541254
assert await r.msetex(mapping={"1:{test:1}": 11}, keepttl=True) == 1
1255-
assert await r.ttl("1") < 10
1255+
assert await r.ttl("1:{test:1}") < 10
12561256

12571257
@pytest.mark.onlycluster
12581258
@skip_if_server_version_lt("8.3.224")
@@ -1266,7 +1266,7 @@ async def test_msetex_expiration_px_with_cluster_client(self, r):
12661266
# with expiration - testing px field
12671267
assert await r.msetex(mapping=mapping, px=60000) == 1
12681268

1269-
ttls = [await r.ttl(key) for key in mapping.keys()]
1269+
ttls = await asyncio.gather(*[r.ttl(key) for key in mapping.keys()])
12701270
for ttl in ttls:
12711271
assert pytest.approx(ttl) == 60
12721272
assert await r.mget(*mapping.keys()) == [b"1", b"2"]
@@ -1297,7 +1297,7 @@ async def test_msetex_expiration_pxat_and_nx_with_cluster_client(self, r):
12971297
)
12981298
== 0
12991299
)
1300-
ttls = [await r.ttl(key) for key in mapping.keys()]
1300+
ttls = await asyncio.gather(*[r.ttl(key) for key in mapping.keys()])
13011301
for ttl in ttls:
13021302
assert 10 < ttl <= 30
13031303
assert await r.mget(*mapping.keys(), "new:{test:1}") == [
@@ -1316,8 +1316,8 @@ async def test_msetex_expiration_pxat_and_nx_with_cluster_client(self, r):
13161316
)
13171317
== 1
13181318
)
1319-
old_ttls = [await r.ttl(key) for key in mapping.keys()]
1320-
new_ttls = [await r.ttl(key) for key in ["new:{test:1}", "new_2:{test:1}"]]
1319+
old_ttls = await asyncio.gather(*[r.ttl(key) for key in mapping.keys()])
1320+
new_ttls = await asyncio.gather(*(r.ttl(key) for key in ["new", "new_2"]))
13211321
for ttl in old_ttls:
13221322
assert 10 < ttl <= 30
13231323
for ttl in new_ttls:
@@ -1350,7 +1350,7 @@ async def test_msetex_expiration_exat_and_xx_with_cluster_client(self, r):
13501350
)
13511351
== 0
13521352
)
1353-
ttls = [await r.ttl(key) for key in mapping.keys()]
1353+
ttls = await asyncio.gather(*[r.ttl(key) for key in mapping.keys()])
13541354
for ttl in ttls:
13551355
assert 10 < ttl <= 30
13561356
assert await r.mget(*mapping.keys(), "new:{test:1}") == [
@@ -1369,7 +1369,7 @@ async def test_msetex_expiration_exat_and_xx_with_cluster_client(self, r):
13691369
)
13701370
== 1
13711371
)
1372-
ttls = [await r.ttl(key) for key in mapping.keys()]
1372+
ttls = await asyncio.gather(*[r.ttl(key) for key in mapping.keys()])
13731373
assert ttls[0] <= 10
13741374
assert ttls[1] <= 10
13751375
assert 10 < ttls[2] <= 30
@@ -1417,7 +1417,7 @@ async def test_msetex_expiration_ex_and_keepttl(self, r):
14171417
)
14181418
== 1
14191419
)
1420-
ttls = [await r.ttl(key) for key in all_test_keys]
1420+
ttls = await asyncio.gather(*[r.ttl(key) for key in all_test_keys])
14211421
for ttl in ttls:
14221422
assert pytest.approx(ttl) == 10
14231423

@@ -1439,7 +1439,7 @@ async def test_msetex_expiration_px(self, r):
14391439
# with expiration - testing px field
14401440
assert await r.msetex(mapping=mapping, px=60000) == 1
14411441

1442-
ttls = [await r.ttl(key) for key in mapping.keys()]
1442+
ttls = await asyncio.gather(*[r.ttl(key) for key in mapping.keys()])
14431443
for ttl in ttls:
14441444
assert pytest.approx(ttl) == 60
14451445
assert await r.mget(*mapping.keys()) == [b"1", b"2"]
@@ -1464,7 +1464,7 @@ async def test_msetex_expiration_pxat_and_nx(self, r):
14641464
)
14651465
== 0
14661466
)
1467-
ttls = [await r.ttl(key) for key in mapping.keys()]
1467+
ttls = await asyncio.gather(*[r.ttl(key) for key in mapping.keys()])
14681468
for ttl in ttls:
14691469
assert 10 < ttl <= 30
14701470
assert await r.mget(*mapping.keys(), "new") == [b"1", b"2", b"three", None]
@@ -1478,8 +1478,8 @@ async def test_msetex_expiration_pxat_and_nx(self, r):
14781478
)
14791479
== 1
14801480
)
1481-
old_ttls = [await r.ttl(key) for key in mapping.keys()]
1482-
new_ttls = [await r.ttl(key) for key in ["new", "new_2"]]
1481+
old_ttls = await asyncio.gather(*[r.ttl(key) for key in mapping.keys()])
1482+
new_ttls = await asyncio.gather(*(r.ttl(key) for key in ["new", "new_2"]))
14831483
for ttl in old_ttls:
14841484
assert 10 < ttl <= 30
14851485
for ttl in new_ttls:
@@ -1512,7 +1512,7 @@ async def test_msetex_expiration_exat_and_xx(self, r):
15121512
)
15131513
== 0
15141514
)
1515-
ttls = [await r.ttl(key) for key in mapping.keys()]
1515+
ttls = await asyncio.gather(*[r.ttl(key) for key in mapping.keys()])
15161516
for ttl in ttls:
15171517
assert 10 < ttl <= 30
15181518
assert await r.mget(*mapping.keys(), "new") == [b"1", b"2", b"three", None]
@@ -1526,7 +1526,7 @@ async def test_msetex_expiration_exat_and_xx(self, r):
15261526
)
15271527
== 1
15281528
)
1529-
ttls = [await r.ttl(key) for key in mapping.keys()]
1529+
ttls = await asyncio.gather(*[r.ttl(key) for key in mapping.keys()])
15301530
assert ttls[0] <= 10
15311531
assert ttls[1] <= 10
15321532
assert 10 < ttls[2] <= 30

tests/test_commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,7 @@ def test_msetex_expiration_ex_and_keepttl_with_cluster_client(self, r):
18511851
time.sleep(1.1)
18521852
# validate keepttl
18531853
assert r.msetex(mapping={"1:{test:1}": 11}, keepttl=True) == 1
1854-
assert r.ttl("1") < 10
1854+
assert r.ttl("1:{test:1}") < 10
18551855

18561856
@pytest.mark.onlycluster
18571857
@skip_if_server_version_lt("8.3.224")
@@ -2017,7 +2017,7 @@ def test_msetex_expiration_ex_and_keepttl(self, r):
20172017
@pytest.mark.onlynoncluster
20182018
@skip_if_server_version_lt("8.3.224")
20192019
def test_msetex_expiration_px(self, r):
2020-
all_test_keys = ["1:{test:1}", "2:{test:1}"]
2020+
all_test_keys = ["1", "2"]
20212021
for key in all_test_keys:
20222022
r.delete(key)
20232023

0 commit comments

Comments
 (0)