Esempio n. 1
0
def test_record_int_serialization_overflow_value():
    r1 = Record(tree_conf, 42, overflow_page=5)
    data = r1.dump()

    r2 = Record(tree_conf, data=data)

    assert r1 == r2
    assert r1.value == r2.value
    assert r1.overflow_page == r2.overflow_page
Esempio n. 2
0
def test_record_str_serialization():
    tree_conf = TreeConf(4096, 4, 40, 40, StrSerializer())
    r1 = Record(tree_conf, '0', b'0')
    data = r1.dump()

    r2 = Record(tree_conf, data=data)

    assert r1 == r2
    assert r1.value == r2.value
    assert r1.overflow_page == r2.overflow_page
Esempio n. 3
0
def test_record_either_value_or_overflow_page():
    r1 = Record(tree_conf, 42, b'foo')
    r1.overflow_page = 10

    with pytest.raises(AssertionError):
        r1.dump()