diff options
author | Utkarsh Gupta <utkarshgupta137@gmail.com> | 2022-05-30 20:05:19 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-30 17:35:19 +0300 |
commit | c54dfa49dda6a7b3389dc230726293af3ffc68a3 (patch) | |
tree | fd972a79a8bef1b29829426c86a7386abb44ba73 /tests/test_commands.py | |
parent | f704281cf4c1f735c06a13946fcea42fa939e3a5 (diff) | |
download | redis-py-c54dfa49dda6a7b3389dc230726293af3ffc68a3.tar.gz |
update black to 22.3.0 (#2171)
Diffstat (limited to 'tests/test_commands.py')
-rw-r--r-- | tests/test_commands.py | 100 |
1 files changed, 26 insertions, 74 deletions
diff --git a/tests/test_commands.py b/tests/test_commands.py index a3972a5..d4a564c 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -89,10 +89,7 @@ class TestRedisCommands: request.addfinalizer(teardown) assert r.acl_setuser( - username, - enabled=True, - passwords=["+strong_password"], - commands=["+acl"], + username, enabled=True, passwords=["+strong_password"], commands=["+acl"] ) assert r.auth(username=username, password="strong_password") is True @@ -128,11 +125,7 @@ class TestRedisCommands: request.addfinalizer(teardown) - r.acl_setuser( - username, - keys=["*"], - commands=["+set"], - ) + r.acl_setuser(username, keys=["*"], commands=["+set"]) assert r.acl_dryrun(username, "set", "key", "value") == b"OK" assert r.acl_dryrun(username, "get", "key").startswith( b"This user has no permissions to run the" @@ -3360,18 +3353,15 @@ class TestRedisCommands: (2.19093829393386841, 41.43379028184083523), ] ] - assert ( - r.geosearch( - "barcelona", - longitude=2.191, - latitude=41.433, - radius=1, - unit="km", - withdist=True, - withcoord=True, - ) - == [[b"place1", 0.0881, (2.19093829393386841, 41.43379028184083523)]] - ) + assert r.geosearch( + "barcelona", + longitude=2.191, + latitude=41.433, + radius=1, + unit="km", + withdist=True, + withcoord=True, + ) == [[b"place1", 0.0881, (2.19093829393386841, 41.43379028184083523)]] assert r.geosearch( "barcelona", longitude=2.191, @@ -3701,7 +3691,7 @@ class TestRedisCommands: def test_xadd(self, r): stream = "stream" message_id = r.xadd(stream, {"foo": "bar"}) - assert re.match(br"[0-9]+\-[0-9]+", message_id) + assert re.match(rb"[0-9]+\-[0-9]+", message_id) # explicit message id message_id = b"9999999999999999999-0" @@ -3847,17 +3837,14 @@ class TestRedisCommands: # reclaim the message as consumer1, but use the justid argument # which only returns message ids - assert ( - r.xclaim( - stream, - group, - consumer1, - min_idle_time=0, - message_ids=(message_id,), - justid=True, - ) - == [message_id] - ) + assert r.xclaim( + stream, + group, + consumer1, + min_idle_time=0, + message_ids=(message_id,), + justid=True, + ) == [message_id] @skip_if_server_version_lt("7.0.0") def test_xclaim_trimmed(self, r): @@ -4228,34 +4215,17 @@ class TestRedisCommands: expected = [ [ stream.encode(), - [ - get_stream_message(r, stream, m1), - get_stream_message(r, stream, m2), - ], + [get_stream_message(r, stream, m1), get_stream_message(r, stream, m2)], ] ] # xread starting at 0 returns both messages assert r.xread(streams={stream: 0}) == expected - expected = [ - [ - stream.encode(), - [ - get_stream_message(r, stream, m1), - ], - ] - ] + expected = [[stream.encode(), [get_stream_message(r, stream, m1)]]] # xread starting at 0 and count=1 returns only the first message assert r.xread(streams={stream: 0}, count=1) == expected - expected = [ - [ - stream.encode(), - [ - get_stream_message(r, stream, m2), - ], - ] - ] + expected = [[stream.encode(), [get_stream_message(r, stream, m2)]]] # xread starting at m1 returns only the second message assert r.xread(streams={stream: m1}) == expected @@ -4274,10 +4244,7 @@ class TestRedisCommands: expected = [ [ stream.encode(), - [ - get_stream_message(r, stream, m1), - get_stream_message(r, stream, m2), - ], + [get_stream_message(r, stream, m1), get_stream_message(r, stream, m2)], ] ] # xread starting at 0 returns both messages @@ -4286,14 +4253,7 @@ class TestRedisCommands: r.xgroup_destroy(stream, group) r.xgroup_create(stream, group, 0) - expected = [ - [ - stream.encode(), - [ - get_stream_message(r, stream, m1), - ], - ] - ] + expected = [[stream.encode(), [get_stream_message(r, stream, m1)]]] # xread with count=1 returns only the first message assert r.xreadgroup(group, consumer, streams={stream: ">"}, count=1) == expected @@ -4320,15 +4280,7 @@ class TestRedisCommands: r.xgroup_destroy(stream, group) r.xgroup_create(stream, group, "0") # delete all the messages in the stream - expected = [ - [ - stream.encode(), - [ - (m1, {}), - (m2, {}), - ], - ] - ] + expected = [[stream.encode(), [(m1, {}), (m2, {})]]] r.xreadgroup(group, consumer, streams={stream: ">"}) r.xtrim(stream, 0) assert r.xreadgroup(group, consumer, streams={stream: "0"}) == expected |