From ee859415944d03c1e5167ef210907579784660c0 Mon Sep 17 00:00:00 2001 From: iandyh Date: Thu, 18 Feb 2016 17:23:11 +0900 Subject: [PATCH] pep8 code --- tests/conftest.py | 6 ++++-- tests/test_commands.py | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 4739159638..d7b2b14db2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -100,12 +100,14 @@ def mock_cluster_resp_nodes(request, **kwargs): 'master - 0 1447836263562 3 connected 10923-16383\n' 'fbb23ed8cfa23f17eaf27ff7d0c410492a1093d6 172.17.0.7:7002 ' 'master,fail - 1447829446956 1447829444948 1 disconnected\n' - ) + ) return _gen_cluster_mock_resp(r, response) @pytest.fixture() def mock_cluster_resp_slaves(request, **kwargs): r = _get_client(redis.Redis, request, **kwargs) - response = "['1df047e5a594f945d82fc140be97a1452bcbf93e 172.17.0.7:7007 slave 19efe5a631f3296fdf21a5441680f893e8cc96ec 0 1447836789290 3 connected']" + response = ("['1df047e5a594f945d82fc140be97a1452bcbf93e 172.17.0.7:7007 " + "slave 19efe5a631f3296fdf21a5441680f893e8cc96ec 0 " + "1447836789290 3 connected']") return _gen_cluster_mock_resp(r, response) diff --git a/tests/test_commands.py b/tests/test_commands.py index afd782ef21..5eede73338 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1295,7 +1295,7 @@ def test_sort_groups_three_gets(self, r): (b('u1'), b('d1'), b('1')), (b('u2'), b('d2'), b('2')), (b('u3'), b('d3'), b('3')) - ] + ] def test_sort_desc(self, r): r.rpush('a', '2', '3', '1') @@ -1339,7 +1339,7 @@ def test_sort_all_options(self, r): [b('vodka'), b('milk'), b('gin'), b('apple juice')] def test_cluster_addslots(self, mock_cluster_resp_ok): - assert mock_cluster_resp_ok.cluster('ADDSLOTS', 1) == True + assert mock_cluster_resp_ok.cluster('ADDSLOTS', 1) is True def test_cluster_count_failure_reports(self, mock_cluster_resp_int): assert isinstance(mock_cluster_resp_int.cluster( @@ -1350,13 +1350,13 @@ def test_cluster_countkeysinslot(self, mock_cluster_resp_int): 'COUNTKEYSINSLOT', 2), int) def test_cluster_delslots(self, mock_cluster_resp_ok): - assert mock_cluster_resp_ok.cluster('DELSLOTS', 1) == True + assert mock_cluster_resp_ok.cluster('DELSLOTS', 1) is True def test_cluster_failover(self, mock_cluster_resp_ok): - assert mock_cluster_resp_ok.cluster('FAILOVER', 1) == True + assert mock_cluster_resp_ok.cluster('FAILOVER', 1) is True def test_cluster_forget(self, mock_cluster_resp_ok): - assert mock_cluster_resp_ok.cluster('FORGET', 1) == True + assert mock_cluster_resp_ok.cluster('FORGET', 1) is True def test_cluster_info(self, mock_cluster_resp_info): assert isinstance(mock_cluster_resp_info.cluster('info'), dict) @@ -1366,23 +1366,23 @@ def test_cluster_keyslot(self, mock_cluster_resp_int): 'keyslot', 'asdf'), int) def test_cluster_meet(self, mock_cluster_resp_ok): - assert mock_cluster_resp_ok.cluster('meet', 'ip', 'port', 1) == True + assert mock_cluster_resp_ok.cluster('meet', 'ip', 'port', 1) is True def test_cluster_nodes(self, mock_cluster_resp_nodes): assert isinstance(mock_cluster_resp_nodes.cluster('nodes'), dict) def test_cluster_replicate(self, mock_cluster_resp_ok): - assert mock_cluster_resp_ok.cluster('replicate', 'nodeid') == True + assert mock_cluster_resp_ok.cluster('replicate', 'nodeid') is True def test_cluster_reset(self, mock_cluster_resp_ok): - assert mock_cluster_resp_ok.cluster('reset', 'hard') == True + assert mock_cluster_resp_ok.cluster('reset', 'hard') is True def test_cluster_saveconfig(self, mock_cluster_resp_ok): - assert mock_cluster_resp_ok.cluster('saveconfig') == True + assert mock_cluster_resp_ok.cluster('saveconfig') is True def test_cluster_setslot(self, mock_cluster_resp_ok): assert mock_cluster_resp_ok.cluster('setslot', 1, - 'IMPORTING', 'nodeid') == True + 'IMPORTING', 'nodeid') is True def test_cluster_slaves(self, mock_cluster_resp_slaves): assert isinstance(mock_cluster_resp_slaves.cluster( @@ -1425,6 +1425,7 @@ def test_strict_pttl(self, sr): class TestBinarySave(object): + def test_binary_get_set(self, r): assert r.set(' foo bar ', '123') assert r.get(' foo bar ') == b('123')