1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00
Files
vcrpy/tests/assertions.py
Sebastian Pipping 05f61ea56c Make json.loads of Python >=3.6 decode bytes by itself
Quoting https://docs.python.org/3/library/json.html#json.loads :
> Changed in version 3.6: s can now be of type bytes or bytearray.
> The input encoding should be UTF-8, UTF-16 or UTF-32.
2023-07-07 20:00:57 +02:00

23 lines
401 B
Python

import json
def assert_cassette_empty(cass):
assert len(cass) == 0
assert cass.play_count == 0
def assert_cassette_has_one_response(cass):
assert len(cass) == 1
assert cass.play_count == 1
def assert_is_json_bytes(b: bytes):
assert isinstance(b, bytes)
try:
json.loads(b)
except Exception as error:
raise AssertionError() from error
assert True