Ejemplo n.º 1
0
def test_normal_constant_string():
    constant_value = struct.unpack('<d', b'helloAAA')[0]
    cdc = codec.ConstantString('column',
                               constant_value,
                               constant_value,
                               DataType.STRING,
                               has_missing=False)
    encoded = b''

    _check_decode(cdc, encoded, 'helloAAA')
Ejemplo n.º 2
0
def test_null_terminated_constant_string():
    """
    This tests the (somewhat dubious) 'missing' values in some (older) data
    encoded from ODB-1 using the migrator. This data uses the integer missing value,
    casted to a double, that happens to start with \x00 --> "NULL STRING"

    We need to support decoding this data...
    """
    constant_value = struct.unpack('<d', b'\x00\x00\xc0\xff\xff\xff\xdfA')[0]
    cdc = codec.ConstantString('column',
                               constant_value,
                               constant_value,
                               DataType.STRING,
                               has_missing=False)
    encoded = b''

    _check_decode(cdc, encoded, '')