Skip to content

Commit 9f3d730

Browse files
committed
Merge pull request influxdata#58 from areski/fixpep8
Fixed PEP8
2 parents 1388161 + 1afb525 commit 9f3d730

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

tests/influxdb/client_test.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ def request(*args, **kwargs):
4343

4444
# Anyway, Content must be a JSON string (or empty string)
4545
if not isinstance(c, str):
46-
c = json.dumps(c)
46+
c = json.dumps(c)
4747

4848
return _build_response_object(status_code=status_code, content=c)
4949

5050
mocked = patch.object(
5151
session,
5252
'request',
53-
side_effect = request
54-
)
53+
side_effect=request
54+
)
5555

5656
return mocked
5757

@@ -88,7 +88,7 @@ def test_write_points(self):
8888
}
8989
]
9090

91-
with _mocked_session('post', 200, data) as mocked:
91+
with _mocked_session('post', 200, data):
9292
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
9393
assert cli.write_points(data) is True
9494

@@ -115,7 +115,7 @@ def test_write_points_udp(self):
115115

116116
@raises(Exception)
117117
def test_write_points_fails(self):
118-
with _mocked_session('post', 500) as mocked:
118+
with _mocked_session('post', 500):
119119
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
120120
cli.write_points([])
121121

@@ -131,13 +131,13 @@ def test_write_points_with_precision(self):
131131
}
132132
]
133133

134-
with _mocked_session('post', 200, data) as mocked:
134+
with _mocked_session('post', 200, data):
135135
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
136136
assert cli.write_points_with_precision(data) is True
137137

138138
@raises(Exception)
139139
def test_write_points_with_precision_fails(self):
140-
with _mocked_session('post', 500) as mocked:
140+
with _mocked_session('post', 500):
141141
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
142142
cli.write_points_with_precision([])
143143

@@ -154,7 +154,7 @@ def test_delete_points(self):
154154

155155
@raises(Exception)
156156
def test_delete_points_with_wrong_name(self):
157-
with _mocked_session('delete', 400) as mocked:
157+
with _mocked_session('delete', 400):
158158
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
159159
cli.delete_points("nonexist")
160160

@@ -175,70 +175,71 @@ def test_remove_scheduled_delete(self):
175175

176176
def test_query(self):
177177
data = [
178-
{ "name":"foo",
178+
{
179+
"name": "foo",
179180
"columns": ["time", "sequence_number", "column_one"],
180181
"points": [
181182
[1383876043, 16, "2"], [1383876043, 15, "1"],
182183
[1383876035, 14, "2"], [1383876035, 13, "1"]
183184
]
184185
}
185186
]
186-
with _mocked_session('get', 200, data) as mocked:
187+
with _mocked_session('get', 200, data):
187188
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
188189
result = cli.query('select column_one from foo;')
189190
assert len(result[0]['points']) == 4
190191

191192
@raises(Exception)
192193
def test_query_fail(self):
193-
with _mocked_session('get', 401) as mocked:
194+
with _mocked_session('get', 401):
194195
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
195196
cli.query('select column_one from foo;')
196197

197198
def test_create_database(self):
198-
with _mocked_session('post', 201, {"name": "new_db"}) as mocked:
199+
with _mocked_session('post', 201, {"name": "new_db"}):
199200
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
200201
assert cli.create_database('new_db') is True
201202

202203
@raises(Exception)
203204
def test_create_database_fails(self):
204-
with _mocked_session('post', 401) as mocked:
205+
with _mocked_session('post', 401):
205206
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
206207
cli.create_database('new_db')
207208

208209
def test_delete_database(self):
209-
with _mocked_session('delete', 204) as mocked:
210+
with _mocked_session('delete', 204):
210211
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
211212
assert cli.delete_database('old_db') is True
212213

213214
@raises(Exception)
214215
def test_delete_database_fails(self):
215-
with _mocked_session('delete', 401) as mocked:
216+
with _mocked_session('delete', 401):
216217
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
217218
cli.delete_database('old_db')
218219

219220
def test_get_database_list(self):
220221
data = [
221222
{"name": "a_db"}
222223
]
223-
with _mocked_session('get', 200, data) as mocked:
224+
with _mocked_session('get', 200, data):
224225
cli = InfluxDBClient('host', 8086, 'username', 'password')
225226
assert len(cli.get_database_list()) == 1
226227
assert cli.get_database_list()[0]['name'] == 'a_db'
227228

228229
@raises(Exception)
229230
def test_get_database_list_fails(self):
230-
with _mocked_session('get', 401) as mocked:
231+
with _mocked_session('get', 401):
231232
cli = InfluxDBClient('host', 8086, 'username', 'password')
232233
cli.get_database_list()
233234

234235
def test_delete_series(self):
235-
with _mocked_session('delete', 204) as mocked:
236+
with _mocked_session('delete', 204):
236237
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
237238
cli.delete_series('old_series')
238239

239240
@raises(Exception)
240241
def test_delete_series_fails(self):
241-
with _mocked_session('delete', 401) as mocked:
242+
with _mocked_session('delete', 401):
242243
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
243244
cli.delete_series('old_series')
244245

@@ -295,4 +296,4 @@ def test_delete_database_user(self):
295296
@raises(NotImplementedError)
296297
def test_update_permission(self):
297298
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
298-
cli.update_permission('admin', [])
299+
cli.update_permission('admin', [])

0 commit comments

Comments
 (0)