Skip to content

Commit f34c8a2

Browse files
committed
Black reformatting v2
1 parent efb3e26 commit f34c8a2

15 files changed

+659
-644
lines changed

tests/betamax_utils.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from urllib.parse import urlsplit
1818

1919

20-
log = logging.getLogger('sasctl.betamax')
20+
log = logging.getLogger("sasctl.betamax")
2121

2222

2323
class BinarySerializer(BaseSerializer):
@@ -32,17 +32,18 @@ class BinarySerializer(BaseSerializer):
3232
by the compression.
3333
3434
"""
35-
name = 'binary'
35+
36+
name = "binary"
3637
stored_as_binary = False
3738

3839
@staticmethod
3940
def generate_cassette_name(cassette_library_dir, cassette_name):
40-
return os.path.join(cassette_library_dir, f'{cassette_name}.lzma')
41+
return os.path.join(cassette_library_dir, f"{cassette_name}.lzma")
4142

4243
def serialize(self, cassette_data):
4344
data = pickle.dumps(cassette_data)
4445
data = lzma.compress(data)
45-
return base64.b85encode(data).decode('utf-8')
46+
return base64.b85encode(data).decode("utf-8")
4647

4748
def deserialize(self, cassette_data):
4849
try:
@@ -60,37 +61,37 @@ class RedactedPathMatcher(PathMatcher):
6061
ession ids in the path are ignored.
6162
"""
6263

63-
name = 'redacted_path'
64+
name = "redacted_path"
6465

6566
def _strip_session_id(self, path):
66-
match = re.search(r'(?<=sessions/)[0-9a-f\-]*', path)
67+
match = re.search(r"(?<=sessions/)[0-9a-f\-]*", path)
6768
if match:
68-
path = path.replace(match.group(0), '')
69+
path = path.replace(match.group(0), "")
6970
return path
7071

7172
def match(self, request, recorded_request):
7273
request_path = self._strip_session_id(urlsplit(request.url).path)
73-
recorded_path = self._strip_session_id(urlsplit(recorded_request['uri']).path)
74+
recorded_path = self._strip_session_id(urlsplit(recorded_request["uri"]).path)
7475
return request_path == recorded_path
7576

7677

7778
class PartialBodyMatcher(BaseMatcher):
7879
# Matches based on the body of the request
79-
name = 'partial_body'
80+
name = "partial_body"
8081

8182
def match(self, request, recorded_request):
8283
recorded_request = util.deserialize_prepared_request(recorded_request)
8384

84-
request_body = b''
85+
request_body = b""
8586
if request.body:
8687
request_body = util.coerce_content(request.body)
8788

88-
recorded_body = b''
89+
recorded_body = b""
8990
if recorded_request.body:
9091
recorded_body = util.coerce_content(recorded_request.body)
9192

9293
if recorded_body != request_body:
9394
diff = difflib.context_diff(recorded_body, request_body)
94-
log.debug('** Cassette Differences: **\n' + '\n'.join(diff))
95+
log.debug("** Cassette Differences: **\n" + "\n".join(diff))
9596

96-
return recorded_body == request_body
97+
return recorded_body == request_body

0 commit comments

Comments
 (0)