Skip to content

Commit

Permalink
pep8 code
Browse files Browse the repository at this point in the history
  • Loading branch information
iandyh committed Feb 19, 2016
1 parent fa3e17a commit ee85941
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
6 changes: 4 additions & 2 deletions tests/conftest.py
Expand Up @@ -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)
21 changes: 11 additions & 10 deletions tests/test_commands.py
Expand Up @@ -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')
Expand Down Expand Up @@ -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(
Expand All @@ -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)
Expand All @@ -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(
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit ee85941

Please sign in to comment.