def test_thaw_errors(): buf = freeze_basic_mapping({ 'hello': 'world' }) for s in (buf[1:], buf[:-1], b'"foo"[2]', b'open("/dev/null", "r")', b'"foo".__class__'): with pytest.raises(ThawError): thaw_basic_mapping(s)
def test_simple(): d = { 'hello': 42, 'world': True, 'data': b'fooxyz', 'str': 'nice' } assert thaw_basic_mapping(freeze_basic_mapping(d)) == d