Skip to content

Commit

Permalink
style: fix formatting issues to comply with pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnsilva committed Jan 4, 2025
1 parent 36c7465 commit d64cdd3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions tests/integration/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def some_test():

assert not os.path.exists(str(tmpdir.join("dontsave2.yml")))


def test_set_drop_unused_requests(tmpdir, httpbin):
my_vcr = vcr.VCR(drop_unused_requests=True)
file = str(tmpdir.join("test.yaml"))
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_cassettes.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def test_used_interactions(tmpdir):
interactions = [
{"request": {"body": "", "uri": "foo1", "method": "GET", "headers": {}}, "response": "bar1"},
{"request": {"body": "", "uri": "foo2", "method": "GET", "headers": {}}, "response": "bar2"},
{"request": {"body": "", "uri": "foo3", "method": "GET", "headers": {}}, "response": "bar3"}
{"request": {"body": "", "uri": "foo3", "method": "GET", "headers": {}}, "response": "bar3"},
]
file = tmpdir.join("test_cassette.yml")
file.write(yaml.dump({"interactions": [interactions[0], interactions[1]]}))
Expand Down
8 changes: 5 additions & 3 deletions vcr/cassette.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,10 @@ def _new_interactions(self):
"""List of new HTTP interactions (request/response tuples)"""
new_interactions = []
for request, response in self.data:
if all(not requests_match(request, old_request, self._match_on)
for old_request, _ in self._old_interactions):
if all(
not requests_match(request, old_request, self._match_on)
for old_request, _ in self._old_interactions
):
new_interactions.append((request, response))
return new_interactions

Expand All @@ -363,7 +365,7 @@ def _as_dict(self):
return {"requests": requests, "responses": responses}

def _save(self, force=False):
if (len(self._played_interactions) < len(self._old_interactions)):
if len(self._played_interactions) < len(self._old_interactions):
force = True
if force or self.dirty:
self._persister.save_cassette(self._path, self._as_dict(), serializer=self._serializer)
Expand Down

0 comments on commit d64cdd3

Please sign in to comment.