diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2018-11-13 15:31:18 -0800 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2018-11-13 15:31:18 -0800 |
commit | 90a52dd5de111f0053bb3ebaa7c78f73a82a1e3e (patch) | |
tree | dd5757ca5a97400327b51cf51c4b8f5354832603 /tests/test_commands.py | |
parent | 69effc2464fada8a51658f97d8a251b2e736e34d (diff) | |
download | redis-py-90a52dd5de111f0053bb3ebaa7c78f73a82a1e3e.tar.gz |
force mapping to be a single dict object on MSET, MSETNX and ZADD
Previously MSET, MSETNX and ZADD accepted multiple ways to specify the
mapping of keys to values including via **kwargs. This turned out to be
a poor choice. As Redis evolved and added additional options to the ZADD
command, these options couldn't be specified in redis-py without possible
element name conflictd. This fixes that going forward and makes the commands
simpler.
Diffstat (limited to 'tests/test_commands.py')
-rw-r--r-- | tests/test_commands.py | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/tests/test_commands.py b/tests/test_commands.py index a264d3a..de94a71 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -481,12 +481,6 @@ class TestRedisCommands(object): for k, v in iteritems(d): assert r[k] == v - def test_mset_kwargs(self, r): - d = {'a': b'1', 'b': b'2', 'c': b'3'} - assert r.mset(**d) - for k, v in iteritems(d): - assert r[k] == v - def test_msetnx(self, r): d = {'a': b'1', 'b': b'2', 'c': b'3'} assert r.msetnx(d) @@ -496,15 +490,6 @@ class TestRedisCommands(object): assert r[k] == v assert r.get('d') is None - def test_msetnx_kwargs(self, r): - d = {'a': b'1', 'b': b'2', 'c': b'3'} - assert r.msetnx(**d) - d2 = {'a': b'x', 'd': b'4'} - assert not r.msetnx(**d2) - for k, v in iteritems(d): - assert r[k] == v - assert r.get('d') is None - @skip_if_server_version_lt('2.6.0') def test_pexpire(self, r): assert not r.pexpire('a', 60000) @@ -2200,7 +2185,8 @@ class TestRedisCommands(object): class TestStrictCommands(object): def test_strict_zadd(self, sr): - sr.zadd('a', 1.0, 'a1', 2.0, 'a2', a3=3.0) + mapping = {'a1': 1.0, 'a2': 2.0, 'a3': 3.0} + sr.zadd('a', mapping) assert sr.zrange('a', 0, -1, withscores=True) == \ [(b'a1', 1.0), (b'a2', 2.0), (b'a3', 3.0)] |