Skip to content

Commit 9607753

Browse files
committed
Black
1 parent 4753a9d commit 9607753

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

adafruit_requests.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,9 @@ def _send_request(self, socket, host, method, path, headers, data, json):
478478
self._send(socket, b"Content-Type: application/json\r\n")
479479
if data:
480480
if isinstance(data, dict):
481-
self._send(socket, b"Content-Type: application/x-www-form-urlencoded\r\n")
481+
self._send(
482+
socket, b"Content-Type: application/x-www-form-urlencoded\r\n"
483+
)
482484
_post_data = ""
483485
for k in data:
484486
_post_data = "{}&{}={}".format(_post_data, k, data[k])
@@ -491,7 +493,6 @@ def _send_request(self, socket, host, method, path, headers, data, json):
491493
else:
492494
self._send(socket, bytes(data, "utf-8"))
493495

494-
495496
# pylint: disable=too-many-branches, too-many-statements, unused-argument, too-many-arguments, too-many-locals
496497
def request(
497498
self, method, url, data=None, json=None, headers=None, stream=False, timeout=60

tests/header_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ def test_json():
1414
sock = mocket.Mocket(response_headers)
1515
pool.socket.return_value = sock
1616
sent = []
17+
1718
def _send(data):
1819
sent.append(data)
1920
return len(data)
21+
2022
sock.send.side_effect = _send
2123

2224
s = adafruit_requests.Session(pool)

tests/protocol_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_get_https_text():
3232
r = s.get("https://" + host + path)
3333

3434
sock.connect.assert_called_once_with((host, 443))
35-
35+
3636
sock.send.assert_has_calls(
3737
[
3838
mock.call(b"GET"),
@@ -63,7 +63,7 @@ def test_get_http_text():
6363
r = s.get("http://" + host + path)
6464

6565
sock.connect.assert_called_once_with((ip, 80))
66-
66+
6767
sock.send.assert_has_calls(
6868
[
6969
mock.call(b"GET"),

tests/reuse_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
text = b"This is a test of Adafruit WiFi!\r\nIf you can read this, its working :)"
1111
response = b"HTTP/1.0 200 OK\r\nContent-Length: 70\r\n\r\n" + text
1212

13+
1314
def test_get_twice():
1415
pool = mocket.MocketPool()
1516
pool.getaddrinfo.return_value = ((None, None, None, None, (ip, 80)),)
@@ -20,7 +21,6 @@ def test_get_twice():
2021
s = adafruit_requests.Session(pool, ssl)
2122
r = s.get("https://" + host + path)
2223

23-
2424
sock.send.assert_has_calls(
2525
[
2626
mock.call(b"GET"),
@@ -38,7 +38,7 @@ def test_get_twice():
3838
assert r.text == str(text, "utf-8")
3939

4040
r = s.get("https://" + host + path + "2")
41-
41+
4242
sock.send.assert_has_calls(
4343
[
4444
mock.call(b"GET"),
@@ -69,7 +69,6 @@ def test_get_twice_after_second():
6969
s = adafruit_requests.Session(pool, ssl)
7070
r = s.get("https://" + host + path)
7171

72-
7372
sock.send.assert_has_calls(
7473
[
7574
mock.call(b"GET"),
@@ -86,7 +85,7 @@ def test_get_twice_after_second():
8685
)
8786

8887
r2 = s.get("https://" + host + path + "2")
89-
88+
9089
sock.send.assert_has_calls(
9190
[
9291
mock.call(b"GET"),
@@ -158,6 +157,7 @@ def test_connect_out_of_memory():
158157
sock.connect.assert_called_once_with((host, 443))
159158
sock3.connect.assert_called_once_with((host2, 443))
160159

160+
161161
def test_second_send_fails():
162162
pool = mocket.MocketPool()
163163
pool.getaddrinfo.return_value = ((None, None, None, None, (ip, 80)),)

0 commit comments

Comments
 (0)