tests/cpydiff: Fix test case for modules_json_nonserializable.

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 <jepler@gmail.com>
This commit is contained in:
Jeff Epler 2024-11-02 13:43:35 -05:00 committed by Damien George
parent 5dfbd43714
commit 3844733d60

View file

@ -6,10 +6,7 @@ workaround: Unknown
""" """
import json import json
a = bytes(x for x in range(256))
try: try:
z = json.dumps(a) print(json.dumps(b"shouldn't be able to serialise bytes"))
x = json.loads(z)
print("Should not get here")
except TypeError: except TypeError:
print("TypeError") print("TypeError")