diff options
author | laixintao <laixintaoo@gmail.com> | 2020-03-10 12:04:36 +0800 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2020-03-12 11:02:10 -0700 |
commit | b9544af2c8eb85fcbe11137e6b0797066e3d718f (patch) | |
tree | c0921cf60bd792bbcb8f2fd6df422c33c7961f53 /tests/test_commands.py | |
parent | 9c8be70e12c501dd0682232e9a7b686ac5e70ec3 (diff) | |
download | redis-py-b9544af2c8eb85fcbe11137e6b0797066e3d718f.tar.gz |
add keepttl option to set command.
fixes #1304
fixes #1280
Diffstat (limited to 'tests/test_commands.py')
-rw-r--r-- | tests/test_commands.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_commands.py b/tests/test_commands.py index 3742edf..3132903 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -867,6 +867,15 @@ class TestRedisCommands(object): assert r.set('a', '1', xx=True, px=10000) assert 0 < r.ttl('a') <= 10 + @skip_if_server_version_lt('5.9.0') # 6.0-rc1 + def test_set_keepttl(self, r): + r['a'] = 'val' + assert r.set('a', '1', xx=True, px=10000) + assert 0 < r.ttl('a') <= 10 + r.set('a', '2', keepttl=True) + assert r.get('a') == b'2' + assert 0 < r.ttl('a') <= 10 + def test_setex(self, r): assert r.setex('a', 60, '1') assert r['a'] == b'1' |