mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-08 16:53:23 +00:00
assertions.py: Fix mis-leading assert_is_json
Parameter name "a_string" was mistaken and function name "assert_is_json" was less clear than ideal, given that it explicitly needs bytes unlike json.loads .
This commit is contained in:
@@ -11,9 +11,10 @@ def assert_cassette_has_one_response(cass):
|
||||
assert cass.play_count == 1
|
||||
|
||||
|
||||
def assert_is_json(a_string):
|
||||
def assert_is_json_bytes(b: bytes):
|
||||
assert isinstance(b, bytes)
|
||||
try:
|
||||
json.loads(a_string.decode("utf-8"))
|
||||
json.loads(b.decode("utf-8"))
|
||||
except Exception:
|
||||
assert False
|
||||
assert True
|
||||
|
||||
Reference in New Issue
Block a user