Skip to content

Commit

Permalink
tests/cpydiff: Fix test case for modules_json_nonserializable.
Browse files Browse the repository at this point in the history
The test case was producing the following error:

    Traceback (most recent call last):
      File "<stdin>", line 12, in <module>
    UnicodeError:

which did not demonstrate the intended difference (this particular
non-json-serializable object DID throw an exception! just not TypeError).

The updated test uses a byte string with all ASCII bytes inside, which
better illustrates the diference.

Signed-off-by: Jeff Epler <[email protected]>
  • Loading branch information
jepler authored and dpgeorge committed Nov 11, 2024
1 parent 5dfbd43 commit 3844733
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tests/cpydiff/modules_json_nonserializable.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"""
import json

a = bytes(x for x in range(256))
try:
z = json.dumps(a)
x = json.loads(z)
print("Should not get here")
print(json.dumps(b"shouldn't be able to serialise bytes"))
except TypeError:
print("TypeError")

0 comments on commit 3844733

Please sign in to comment.