@@ -393,9 +393,7 @@ def test_hgetex_no_expiration(r):
393393 r .delete ("test:hash" )
394394 r .hset ("b" , "foo" , "bar" , mapping = {"1" : 1 , "2" : 2 , "3" : "three" , "4" : b"four" })
395395
396- assert r .hgetex ("b" , keys = ["foo" , "1" , "4" ]) == [b"bar" , b"1" , b"four" ]
397- assert r .hgetex ("b" , "foo" , keys = ["1" , "4" ]) == [b"bar" , b"1" , b"four" ]
398- assert r .hgetex ("b" , "foo" ) == [b"bar" ]
396+ assert r .hgetex ("b" , "foo" , "1" , "4" ) == [b"bar" , b"1" , b"four" ]
399397 assert r .httl ("b" , "foo" , "1" , "4" ) == [- 1 , - 1 , - 1 ]
400398
401399
@@ -406,21 +404,21 @@ def test_hgetex_expiration_configs(r):
406404 test_keys = ["foo" , "1" , "4" ]
407405
408406 # test get with multiple fields with expiration set through 'ex'
409- assert r .hgetex ("test:hash" , keys = test_keys , ex = 10 ) == [b"bar" , b"1" , b"four" ]
407+ assert r .hgetex ("test:hash" , * test_keys , ex = 10 ) == [b"bar" , b"1" , b"four" ]
410408 ttls = r .httl ("test:hash" , * test_keys )
411409 for ttl in ttls :
412410 assert pytest .approx (ttl ) == 10
413411
414412 # test get with multiple fields removing expiration settings with 'persist'
415- assert r .hgetex ("test:hash" , keys = test_keys , persist = True ) == [
413+ assert r .hgetex ("test:hash" , * test_keys , persist = True ) == [
416414 b"bar" ,
417415 b"1" ,
418416 b"four" ,
419417 ]
420418 assert r .httl ("test:hash" , * test_keys ) == [- 1 , - 1 , - 1 ]
421419
422420 # test get with multiple fields with expiration set through 'px'
423- assert r .hgetex ("test:hash" , keys = test_keys , px = 6000 ) == [b"bar" , b"1" , b"four" ]
421+ assert r .hgetex ("test:hash" , * test_keys , px = 6000 ) == [b"bar" , b"1" , b"four" ]
424422 ttls = r .httl ("test:hash" , * test_keys )
425423 for ttl in ttls :
426424 assert pytest .approx (ttl ) == 6
@@ -444,17 +442,17 @@ def test_hgetex_validate_expired_fields_removed(r):
444442 test_keys = ["foo" , "1" , "3" ]
445443 # test get multiple fields with expiration set
446444 # validate that expired fields are removed
447- assert r .hgetex ("test:hash" , keys = test_keys , ex = 1 ) == [b"bar" , b"1" , b"three" ]
445+ assert r .hgetex ("test:hash" , * test_keys , ex = 1 ) == [b"bar" , b"1" , b"three" ]
448446 time .sleep (1.1 )
449- assert r .hgetex ("test:hash" , keys = test_keys ) == [None , None , None ]
447+ assert r .hgetex ("test:hash" , * test_keys ) == [None , None , None ]
450448 assert r .httl ("test:hash" , * test_keys ) == [- 2 , - 2 , - 2 ]
451449 assert r .hgetex ("test:hash" , "4" ) == [b"four" ]
452450
453451
454452@skip_if_server_version_lt ("7.9.0" )
455453def test_hgetex_invalid_inputs (r ):
456454 with pytest .raises (exceptions .DataError ):
457- r .hgetex ("b" , keys = [ "foo" , "1" , "3" ] , ex = 10 , persist = True )
455+ r .hgetex ("b" , "foo" , "1" , "3" , ex = 10 , persist = True )
458456
459457 with pytest .raises (exceptions .DataError ):
460458 r .hgetex ("b" , "foo" , ex = 10.0 , persist = True )
@@ -497,7 +495,7 @@ def test_hsetex_expiration_ex_and_keepttl(r):
497495 for ttl in ttls :
498496 assert pytest .approx (ttl ) == 10
499497
500- assert r .hgetex ("test:hash" , keys = [ "foo" , "1" , "2" , "i1" , "i2" ] ) == [
498+ assert r .hgetex ("test:hash" , "foo" , "1" , "2" , "i1" , "i2" ) == [
501499 b"bar" ,
502500 b"1" ,
503501 b"2" ,
@@ -522,7 +520,7 @@ def test_hsetex_expiration_px(r):
522520 ttls = r .httl ("test:hash" , * test_keys )
523521 for ttl in ttls :
524522 assert pytest .approx (ttl ) == 60
525- assert r .hgetex ("test:hash" , keys = test_keys ) == [b"bar" , b"1" , b"2" ]
523+ assert r .hgetex ("test:hash" , * test_keys ) == [b"bar" , b"1" , b"2" ]
526524
527525
528526@skip_if_server_version_lt ("7.9.0" )
@@ -546,7 +544,7 @@ def test_hsetex_expiration_pxat_and_fnx(r):
546544 assert ttls [0 ] <= 30
547545 assert ttls [1 ] == - 2
548546
549- assert r .hgetex ("test:hash" , keys = [ "foo" , "1" , "new" ] ) == [b"bar" , b"1" , None ]
547+ assert r .hgetex ("test:hash" , "foo" , "1" , "new" ) == [b"bar" , b"1" , None ]
550548 assert (
551549 r .hsetex (
552550 "test:hash" ,
@@ -561,7 +559,7 @@ def test_hsetex_expiration_pxat_and_fnx(r):
561559 ttls = r .httl ("test:hash" , "foo" , "new" )
562560 for ttl in ttls :
563561 assert ttl <= 61
564- assert r .hgetex ("test:hash" , keys = [ "foo" , "foo_new" , "new" ] ) == [
562+ assert r .hgetex ("test:hash" , "foo" , "foo_new" , "new" ) == [
565563 b"bar" ,
566564 b"bar1" ,
567565 b"ok" ,
@@ -589,7 +587,7 @@ def test_hsetex_expiration_exat_and_fxx(r):
589587 assert 10 < ttls [0 ] <= 30
590588 assert ttls [1 ] == - 2
591589
592- assert r .hgetex ("test:hash" , keys = [ "foo" , "1" , "new" ] ) == [b"bar" , b"1" , None ]
590+ assert r .hgetex ("test:hash" , "foo" , "1" , "new" ) == [b"bar" , b"1" , None ]
593591 assert (
594592 r .hsetex (
595593 "test:hash" ,
@@ -601,7 +599,7 @@ def test_hsetex_expiration_exat_and_fxx(r):
601599 )
602600 == 1
603601 )
604- assert r .hgetex ("test:hash" , keys = [ "foo" , "1" ] ) == [b"bar1" , b"new_value" ]
602+ assert r .hgetex ("test:hash" , "foo" , "1" ) == [b"bar1" , b"new_value" ]
605603
606604
607605@skip_if_server_version_lt ("7.9.0" )
0 commit comments