kopia lustrzana https://github.com/micropython/micropython-lib
pickle: test_pickle.py: Update for bytes being returned/consumed.
rodzic
22527a6ebd
commit
1c30e28c40
|
@ -5,6 +5,7 @@ import io
|
||||||
|
|
||||||
def roundtrip(val):
|
def roundtrip(val):
|
||||||
t = pickle.dumps(val)
|
t = pickle.dumps(val)
|
||||||
|
assert isinstance(t, bytes)
|
||||||
t = pickle.loads(t)
|
t = pickle.loads(t)
|
||||||
assert t == val
|
assert t == val
|
||||||
|
|
||||||
|
@ -18,7 +19,7 @@ roundtrip([1, 2])
|
||||||
roundtrip({1:2, 3: 4})
|
roundtrip({1:2, 3: 4})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pickle.loads("1; import micropython")
|
pickle.loads(b"1; import micropython")
|
||||||
assert 0, "SyntaxError expected"
|
assert 0, "SyntaxError expected"
|
||||||
except SyntaxError:
|
except SyntaxError:
|
||||||
pass
|
pass
|
||||||
|
|
Ładowanie…
Reference in New Issue