Example #1
0
def test_bad_intpacker():
    with pytest.raises(ValueError):
        int_packer.packinteger('python')
    with pytest.raises(ValueError):
        int_packer.unpackinteger('python')
    with pytest.raises(ValueError):
        int_packer.unpackinteger('fffa')
    with pytest.raises(ValueError):
        int_packer.packinteger(45, 'python')
Example #2
0
def test_bad_intpacker():
    with pytest.raises(ValueError):
        int_packer.packinteger('python')
    with pytest.raises(ValueError):
        int_packer.unpackinteger('python')
    with pytest.raises(ValueError):
        int_packer.unpackinteger('fffa')
    with pytest.raises(ValueError):
        int_packer.packinteger(45, 'python')
Example #3
0
def test_intpacker_return_bytes(val, ex):
    packed = int_packer.packinteger(val, bytes)
Example #4
0
def test_lossy_intpacker(val, ex, err):
    packed = int_packer.packinteger(val)
    assert packed == ex
    unpacked = int_packer.unpackinteger(packed)
    assert abs(unpacked - val) < err
Example #5
0
def test_intpacker(val, ex):
    packed = int_packer.packinteger(val)
    assert packed == ex
    unpacked = int_packer.unpackinteger(packed)
    assert unpacked == val
Example #6
0
def test_intpacker_return_bytes(val, ex):
    packed = int_packer.packinteger(val, bytes)
Example #7
0
def test_lossy_intpacker(val, ex, err):
    packed = int_packer.packinteger(val)
    assert packed == ex
    unpacked = int_packer.unpackinteger(packed)
    assert abs(unpacked - val) < err
Example #8
0
def test_intpacker(val, ex):
    packed = int_packer.packinteger(val)
    assert packed == ex
    unpacked = int_packer.unpackinteger(packed)
    assert unpacked == val