Esempio n. 1
0
def test_dump_load():
    x = ("he", 7, "llo", 8, (), 900, None, True, 18.2, 18.2j + 13,
         slice(1, 2, 3), frozenset([5, 6, 7]), bytes([0x11]))
    assert dumpable(x)
    y = dump(x)
    z = load(y)
    print(x)
    print(y)
    print(z)
    assert x == z
Esempio n. 2
0
def test_dump_load():
    x = ("he", 7, "llo", 8, (), 900, None, True, 18.2, 18.2j + 13,
         slice(1, 2, 3), frozenset([5, 6, 7]), bytes([0x11]))
    assert dumpable(x)
    y = dump(x)
    z = load(y)
    print(x)
    print(y)
    print(z)
    assert x == z
Esempio n. 3
0
def test_pickle_direct():
    x = {1:2}
    y = _pickle(x)
    z =  load(bytes([0x01])+y)
    assert x == z
Esempio n. 4
0
def test_unloadable():
    x = ("he", 7, "llo", 8, (), 900, None, True, 18.2, 18.2j + 13,
         slice(1, 2, 3), frozenset([5, 6, 7]), bytes([0x11]))
    y = dump(x)
    y = bytes([0x02]) + y
    z = load(y)
Esempio n. 5
0
def test_pickle_direct():
    x = {1: 2}
    y = _pickle(x)
    z = load(bytes([0x01]) + y)
    assert x == z
Esempio n. 6
0
def test_unloadable():
    x = ("he", 7, "llo", 8, (), 900, None, True, 18.2, 18.2j + 13,
         slice(1, 2, 3), frozenset([5, 6, 7]), bytes([0x11]))
    y = dump(x)
    y = bytes([0x02]) + y
    z = load(y)