Exemplo n.º 1
0
    def test_reading_one(query, value):
        buffer_ = BytesIO()
        binary = binascii.unhexlify(BINARY[query])

        buffer_.write(b'\1\0\0\0')
        buffer_.write(struct.pack('i', len(binary) + 8))
        buffer_.write(binary)
        buffer_.seek(0)

        sys.stdout.write('  %-75s' % query)
        try:
            header = buffer_reader.read_header(source=buffer_.getvalue())
            result = buffer_reader.read_data(
                message_size=header.size,
                compression_mode=header.compression_mode,
                raw=True)
            assert compare(buffer_.getvalue()[8:],
                           result), 'raw reading failed: %s' % (query)

            stream_reader = qreader.QReader(buffer_)
            result = stream_reader.read(raw=True).data
            assert compare(buffer_.getvalue()[8:],
                           result), 'raw reading failed: %s' % (query)

            result = buffer_reader.read(source=buffer_.getvalue()).data
            if type(value) == QTemporalList:
                assert compare(
                    value, result
                ), 'deserialization failed: %s, expected: %s actual: %s' % (
                    query, [x.raw for x in value], [x.raw for x in result])
            else:
                assert compare(
                    value, result
                ), 'deserialization failed: %s, expected: %s actual: %s' % (
                    query, value, result)

            header = buffer_reader.read_header(source=buffer_.getvalue())
            result = buffer_reader.read_data(
                message_size=header.size,
                compression_mode=header.compression_mode)
            assert compare(value,
                           result), 'deserialization failed: %s' % (query)

            buffer_.seek(0)
            stream_reader = qreader.QReader(buffer_)
            result = stream_reader.read().data
            assert compare(
                value, result
            ), 'deserialization failed: %s, expected: %s actual: %s' % (
                query, value, result)
            print('.')
        except QException as e:
            assert isinstance(value, QException)
            assert e.args == value.args
            print('.')
Exemplo n.º 2
0
def test_reading():
    BINARY = OrderedDict()

    with open('tests/QExpressions3.out', 'rb') as f:
        while True:
            query = f.readline().strip()
            binary = f.readline().strip()

            if not binary:
                break

            BINARY[query] = binary

    buffer_reader = qreader.QReader(None)
    print('Deserialization')
    for query, value in iter(EXPRESSIONS.items()):
        buffer_ = BytesIO()
        binary = binascii.unhexlify(BINARY[query])

        buffer_.write(b'\1\0\0\0')
        buffer_.write(struct.pack('i', len(binary) + 8))
        buffer_.write(binary)
        buffer_.seek(0)

        sys.stdout.write( '  %-75s' % query )
        try:
            header = buffer_reader.read_header(source = buffer_.getvalue())
            result = buffer_reader.read_data(message_size = header.size, is_compressed = header.is_compressed, raw = True)
            assert compare(buffer_.getvalue()[8:], result), 'raw reading failed: %s' % (query)

            stream_reader = qreader.QReader(buffer_)
            result = stream_reader.read(raw = True).data
            assert compare(buffer_.getvalue()[8:], result), 'raw reading failed: %s' % (query)

            result = buffer_reader.read(source = buffer_.getvalue()).data
            assert compare(value, result), 'deserialization failed: %s, expected: %s actual: %s' % (query, value, result)

            header = buffer_reader.read_header(source = buffer_.getvalue())
            result = buffer_reader.read_data(message_size = header.size, is_compressed = header.is_compressed)
            assert compare(value, result), 'deserialization failed: %s' % (query)

            buffer_.seek(0)
            stream_reader = qreader.QReader(buffer_)
            result = stream_reader.read().data
            assert compare(value, result), 'deserialization failed: %s, expected: %s actual: %s' % (query, value, result)
            print('.')
        except QException as e:
            assert isinstance(value, QException)
            assert e.args == value.args
            print('.')
Exemplo n.º 3
0
def test_reading_numpy_temporals():
    BINARY = OrderedDict()
    
    with open('tests/QExpressions3.out', 'rb') as f:
        while True:
            query = f.readline().strip()
            binary = f.readline().strip()

            if not binary:
                break

            BINARY[query] = binary

    print('Deserialization (numpy temporals)')
    for query, value in iter(NUMPY_TEMPORAL_EXPRESSIONS.items()):
        buffer_ = BytesIO()
        binary = binascii.unhexlify(BINARY[query])

        buffer_.write(b'\1\0\0\0')
        buffer_.write(struct.pack('i', len(binary) + 8))
        buffer_.write(binary)
        buffer_.seek(0)

        sys.stdout.write( '  %-75s' % query )
        try:
            buffer_.seek(0)
            stream_reader = qreader.QReader(buffer_)
            result = stream_reader.read(numpy_temporals = True).data
            assert compare(value, result), 'deserialization failed: %s, expected: %s actual: %s' % (query, value, result)
            print('.')
        except QException as e:
            assert isinstance(value, QException)
            assert e.args == value.args
            print('.')
Exemplo n.º 4
0
    def test_reading_pandas():
        print 'Deserialization (pandas)'
        for query, value in PANDAS_EXPRESSIONS.iteritems():
            buffer_ = cStringIO.StringIO()
            binary = binascii.unhexlify(BINARY[query])

            buffer_.write('\1\0\0\0')
            buffer_.write(struct.pack('i', len(binary) + 8))
            buffer_.write(binary)
            buffer_.seek(0)

            sys.stdout.write('  %-75s' % query)
            try:
                buffer_.seek(0)
                stream_reader = qreader.QReader(buffer_)
                result = stream_reader.read(pandas = True).data
                if isinstance(value, dict):
                    if 'index' in value:
                        meta = result.meta
                        result = result.reset_index()
                        result.meta = meta

                    assert value['meta'].as_dict() == result.meta.as_dict(), 'deserialization failed qtype: %s, expected: %s actual: %s' % (query, value['meta'], result.meta)
                    assert compare(value['data'], result), 'deserialization failed: %s, expected: %s actual: %s' % (query, value['data'], result)
                else:
                    assert compare(value, result), 'deserialization failed: %s, expected: %s actual: %s' % (query, value, result)
                print '.'
            except QException, e:
                assert isinstance(value, QException)
                assert e.message == value.message
                print '.'
Exemplo n.º 5
0
def test_reading_compressed():
    BINARY = OrderedDict()

    with open(os.path.join(TEST_DATA_DIR, 'QCompressedExpressions3.out'),
              'rb') as f:
        while True:
            query = f.readline().strip()
            binary = f.readline().strip()

            if not binary:
                break

            BINARY[query] = binary

    print('Compressed deserialization')
    buffer_reader = qreader.QReader(None)
    for query, value in iter(COMPRESSED_EXPRESSIONS.items()):
        buffer_ = BytesIO()
        binary = binascii.unhexlify(BINARY[query])

        buffer_.write(b'\1\0\1\0')
        buffer_.write(struct.pack('i', len(binary) + 8))
        buffer_.write(binary)
        buffer_.seek(0)

        sys.stdout.write('  %-75s' % query)
        try:
            result = buffer_reader.read(source=buffer_.getvalue()).data
            assert compare(value,
                           result), 'deserialization failed: %s' % (query)

            header = buffer_reader.read_header(source=buffer_.getvalue())
            result = buffer_reader.read_data(
                message_size=header.size, is_compressed=header.is_compressed)
            assert compare(value,
                           result), 'deserialization failed: %s' % (query)

            stream_reader = qreader.QReader(buffer_)
            result = stream_reader.read().data
            assert compare(value,
                           result), 'deserialization failed: %s' % (query)
            print('.')
        except QException as e:
            assert isinstance(value, QException)
            assert e.args == value.args
            print('.')
Exemplo n.º 6
0
    def test_reading_numpy_temporals_one(query, value):
        buffer_ = BytesIO()
        binary = binascii.unhexlify(BINARY[query])

        buffer_.write(b'\1\0\0\0')
        buffer_.write(struct.pack('i', len(binary) + 8))
        buffer_.write(binary)
        buffer_.seek(0)

        sys.stdout.write('  %-75s' % query)
        try:
            buffer_.seek(0)
            stream_reader = qreader.QReader(buffer_)
            result = stream_reader.read(numpy_temporals=True).data
            assert compare(
                value, result
            ), 'deserialization failed: %s, expected: %s actual: %s' % (
                query, value, result)
            print('.')
        except QException as e:
            assert isinstance(value, QException)
            assert e.args == value.args
            print('.')
Exemplo n.º 7
0
def test_reading():
    BINARY = OrderedDict()

    with open('tests/QExpressions3.out', 'rb') as f:
        while True:
            query = f.readline().strip()
            binary = f.readline().strip()

            if not binary:
                break

            BINARY[query] = binary

    buffer_reader = qreader.QReader(None)
    print('Deserialization')

    def test_reading_one(query, value):
        buffer_ = BytesIO()
        binary = binascii.unhexlify(BINARY[query])

        buffer_.write(b'\1\0\0\0')
        buffer_.write(struct.pack('i', len(binary) + 8))
        buffer_.write(binary)
        buffer_.seek(0)

        sys.stdout.write('  %-75s' % query)
        try:
            header = buffer_reader.read_header(source=buffer_.getvalue())
            result = buffer_reader.read_data(
                message_size=header.size,
                compression_mode=header.compression_mode,
                raw=True)
            assert compare(buffer_.getvalue()[8:],
                           result), 'raw reading failed: %s' % (query)

            stream_reader = qreader.QReader(buffer_)
            result = stream_reader.read(raw=True).data
            assert compare(buffer_.getvalue()[8:],
                           result), 'raw reading failed: %s' % (query)

            result = buffer_reader.read(source=buffer_.getvalue()).data
            if type(value) == QTemporalList:
                assert compare(
                    value, result
                ), 'deserialization failed: %s, expected: %s actual: %s' % (
                    query, [x.raw for x in value], [x.raw for x in result])
            else:
                assert compare(
                    value, result
                ), 'deserialization failed: %s, expected: %s actual: %s' % (
                    query, value, result)

            header = buffer_reader.read_header(source=buffer_.getvalue())
            result = buffer_reader.read_data(
                message_size=header.size,
                compression_mode=header.compression_mode)
            assert compare(value,
                           result), 'deserialization failed: %s' % (query)

            buffer_.seek(0)
            stream_reader = qreader.QReader(buffer_)
            result = stream_reader.read().data
            assert compare(
                value, result
            ), 'deserialization failed: %s, expected: %s actual: %s' % (
                query, value, result)
            print('.')
        except QException as e:
            assert isinstance(value, QException)
            assert e.args == value.args
            print('.')

    test_reading_one(
        b'("G"$"8c680a01-5a49-5aab-5a65-d4bfddb6a661"; 0Ng)',
        qlist(numpy.array(
            [uuid.UUID('8c680a01-5a49-5aab-5a65-d4bfddb6a661'),
             qnull(QGUID)]),
              qtype=QGUID_LIST))
    test_reading_one(b'"G"$"8c680a01-5a49-5aab-5a65-d4bfddb6a661"',
                     uuid.UUID('8c680a01-5a49-5aab-5a65-d4bfddb6a661'))
    test_reading_one(b'"G"$"00000000-0000-0000-0000-000000000000"',
                     uuid.UUID('00000000-0000-0000-0000-000000000000'))
    test_reading_one(
        b'(2001.01m; 0Nm)',
        qlist(numpy.array([12, qnull(QMONTH)]), qtype=QMONTH_LIST))
    test_reading_one(b'2001.01m',
                     qtemporal(numpy.datetime64('2001-01', 'M'), qtype=QMONTH))
    test_reading_one(b'0Nm',
                     qtemporal(numpy.datetime64('NaT', 'M'), qtype=QMONTH))
    test_reading_one(
        b'2001.01.01 2000.05.01 0Nd',
        qlist(numpy.array([366, 121, qnull(QDATE)]), qtype=QDATE_LIST))
    test_reading_one(
        b'2001.01.01',
        qtemporal(numpy.datetime64('2001-01-01', 'D'), qtype=QDATE))
    test_reading_one(b'0Nd',
                     qtemporal(numpy.datetime64('NaT', 'D'), qtype=QDATE))
    test_reading_one(
        b'2000.01.04T05:36:57.600 0Nz',
        qlist(numpy.array([3.234, qnull(QDATETIME)]), qtype=QDATETIME_LIST))
    test_reading_one(
        b'2000.01.04T05:36:57.600',
        qtemporal(numpy.datetime64('2000-01-04T05:36:57.600', 'ms'),
                  qtype=QDATETIME))
    test_reading_one(b'0Nz',
                     qtemporal(numpy.datetime64('NaT', 'ms'), qtype=QDATETIME))
    test_reading_one(
        b'12:01 0Nu',
        qlist(numpy.array([721, qnull(QMINUTE)]), qtype=QMINUTE_LIST))
    test_reading_one(b'12:01',
                     qtemporal(numpy.timedelta64(721, 'm'), qtype=QMINUTE))
    test_reading_one(b'0Nu',
                     qtemporal(numpy.timedelta64('NaT', 'm'), qtype=QMINUTE))
    test_reading_one(
        b'12:05:00 0Nv',
        qlist(numpy.array([43500, qnull(QSECOND)]), qtype=QSECOND_LIST))
    test_reading_one(b'12:05:00',
                     qtemporal(numpy.timedelta64(43500, 's'), qtype=QSECOND))
    test_reading_one(b'0Nv',
                     qtemporal(numpy.timedelta64('NaT', 's'), qtype=QSECOND))
    test_reading_one(
        b'12:04:59.123 0Nt',
        qlist(numpy.array([43499123, qnull(QTIME)]), qtype=QTIME_LIST))
    test_reading_one(b'12:04:59.123',
                     qtemporal(numpy.timedelta64(43499123, 'ms'), qtype=QTIME))
    test_reading_one(b'0Nt',
                     qtemporal(numpy.timedelta64('NaT', 'ms'), qtype=QTIME))
    test_reading_one(
        b'2000.01.04D05:36:57.600 0Np',
        qlist(numpy.array([long(279417600000000),
                           qnull(QTIMESTAMP)]),
              qtype=QTIMESTAMP_LIST))
    test_reading_one(
        b'2000.01.04D05:36:57.600',
        qtemporal(numpy.datetime64('2000-01-04T05:36:57.600', 'ns'),
                  qtype=QTIMESTAMP))
    test_reading_one(
        b'0Np', qtemporal(numpy.datetime64('NaT', 'ns'), qtype=QTIMESTAMP))
    test_reading_one(
        b'0D05:36:57.600 0Nn',
        qlist(numpy.array([long(20217600000000),
                           qnull(QTIMESPAN)]),
              qtype=QTIMESPAN_LIST))
    test_reading_one(
        b'0D05:36:57.600',
        qtemporal(numpy.timedelta64(20217600000000, 'ns'), qtype=QTIMESPAN))
    test_reading_one(
        b'0Nn', qtemporal(numpy.timedelta64('NaT', 'ns'), qtype=QTIMESPAN))

    test_reading_one(b'::', None)
    test_reading_one(b'1+`', QException(b'type'))
    test_reading_one(b'1', numpy.int64(1))
    test_reading_one(b'1i', numpy.int32(1))
    test_reading_one(b'-234h', numpy.int16(-234))
    test_reading_one(b'0b', numpy.bool_(False))
    test_reading_one(b'1b', numpy.bool_(True))
    test_reading_one(b'0x2a', numpy.byte(0x2a))
    test_reading_one(b'89421099511627575j',
                     numpy.int64(long(89421099511627575)))
    test_reading_one(b'5.5e', numpy.float32(5.5))
    test_reading_one(b'3.234', numpy.float64(3.234))
    test_reading_one(b'"0"', b'0')
    test_reading_one(b'"abc"', b'abc')
    test_reading_one(b'"quick brown fox jumps over a lazy dog"',
                     b'quick brown fox jumps over a lazy dog')
    test_reading_one(b'`abc', numpy.string_('abc'))
    test_reading_one(b'`quickbrownfoxjumpsoveralazydog',
                     numpy.string_('quickbrownfoxjumpsoveralazydog'))
    test_reading_one(b'0Nh', qnull(QSHORT))
    test_reading_one(b'0N', qnull(QLONG))
    test_reading_one(b'0Ni', qnull(QINT))
    test_reading_one(b'0Nj', qnull(QLONG))
    test_reading_one(b'0Ne', qnull(QFLOAT))
    test_reading_one(b'0n', qnull(QDOUBLE))
    test_reading_one(b'" "', qnull(QSTRING))
    test_reading_one(b'`', qnull(QSYMBOL))
    test_reading_one(b'0Ng', qnull(QGUID))
    test_reading_one(b'()', []),
    test_reading_one(
        b'(0b;1b;0b)',
        qlist(numpy.array([False, True, False], dtype=numpy.bool_),
              qtype=QBOOL_LIST))
    test_reading_one(
        b'(0x01;0x02;0xff)',
        qlist(numpy.array([0x01, 0x02, 0xff], dtype=numpy.byte),
              qtype=QBYTE_LIST))
    test_reading_one(
        b'(1h;2h;3h)',
        qlist(numpy.array([1, 2, 3], dtype=numpy.int16), qtype=QSHORT_LIST))
    test_reading_one(
        b'(1h;0Nh;3h)',
        qlist(numpy.array([1, qnull(QSHORT), 3], dtype=numpy.int16),
              qtype=QSHORT_LIST))
    test_reading_one(
        b'1 2 3',
        qlist(numpy.array([1, 2, 3], dtype=numpy.int64), qtype=QLONG_LIST))
    test_reading_one(
        b'1 0N 3',
        qlist(numpy.array([1, qnull(QLONG), 3], dtype=numpy.int64),
              qtype=QLONG_LIST))
    test_reading_one(
        b'(1i;2i;3i)',
        qlist(numpy.array([1, 2, 3], dtype=numpy.int32), qtype=QINT_LIST))
    test_reading_one(
        b'(1i;0Ni;3i)',
        qlist(numpy.array([1, qnull(QINT), 3], dtype=numpy.int32),
              qtype=QINT_LIST))
    test_reading_one(
        b'(1j;2j;3j)',
        qlist(numpy.array([1, 2, 3], dtype=numpy.int64), qtype=QLONG_LIST))
    test_reading_one(
        b'(1j;0Nj;3j)',
        qlist(numpy.array([1, qnull(QLONG), 3], dtype=numpy.int64),
              qtype=QLONG_LIST))
    test_reading_one(
        b'(5.5e; 8.5e)',
        qlist(numpy.array([5.5, 8.5], dtype=numpy.float32), qtype=QFLOAT_LIST))
    test_reading_one(
        b'(5.5e; 0Ne)',
        qlist(numpy.array([5.5, qnull(QFLOAT)], dtype=numpy.float32),
              qtype=QFLOAT_LIST))
    test_reading_one(
        b'3.23 6.46',
        qlist(numpy.array([3.23, 6.46], dtype=numpy.float64),
              qtype=QDOUBLE_LIST))
    test_reading_one(
        b'3.23 0n',
        qlist(numpy.array([3.23, qnull(QDOUBLE)], dtype=numpy.float64),
              qtype=QDOUBLE_LIST))
    test_reading_one(
        b'(1;`bcd;"0bc";5.5e)',
        [numpy.int64(1),
         numpy.string_('bcd'), b'0bc',
         numpy.float32(5.5)])
    test_reading_one(
        b'(42;::;`foo)',
        [numpy.int64(42), None, numpy.string_('foo')])
    test_reading_one(
        b'`the`quick`brown`fox',
        qlist(numpy.array([
            numpy.string_('the'),
            numpy.string_('quick'),
            numpy.string_('brown'),
            numpy.string_('fox')
        ],
                          dtype=object),
              qtype=QSYMBOL_LIST))
    test_reading_one(
        b'``quick``fox',
        qlist(numpy.array([
            qnull(QSYMBOL),
            numpy.string_('quick'),
            qnull(QSYMBOL),
            numpy.string_('fox')
        ],
                          dtype=object),
              qtype=QSYMBOL_LIST))
    test_reading_one(
        b'``',
        qlist(numpy.array([qnull(QSYMBOL), qnull(QSYMBOL)], dtype=object),
              qtype=QSYMBOL_LIST))
    test_reading_one(
        b'("quick"; "brown"; "fox"; "jumps"; "over"; "a lazy"; "dog")',
        [b'quick', b'brown', b'fox', b'jumps', b'over', b'a lazy', b'dog'])
    test_reading_one(
        b'("quick"; " "; "fox"; "jumps"; "over"; "a lazy"; "dog")',
        [b'quick', b' ', b'fox', b'jumps', b'over', b'a lazy', b'dog'])
    test_reading_one(b'{x+y}', QLambda('{x+y}')),
    test_reading_one(b'{x+y}[3]',
                     QProjection([QLambda('{x+y}'),
                                  numpy.int64(3)]))
    test_reading_one(b'insert [1]', QProjection([QFunction(0),
                                                 numpy.int64(1)]))
    test_reading_one(b'xbar', QLambda('k){x*y div x:$[16h=abs[@x];"j"$x;x]}'))
    test_reading_one(b'not', QFunction(0))
    test_reading_one(b'and', QFunction(0))
    test_reading_one(b'md5', QProjection([QFunction(0), numpy.int64(-15)]))
    test_reading_one(b'any', QFunction(0))
    test_reading_one(b'save', QFunction(0))
    test_reading_one(b'raze', QFunction(0))
    test_reading_one(b'sums', QFunction(0))
    test_reading_one(b'prev', QFunction(0))

    test_reading_one(
        b'(enlist `a)!(enlist 1)',
        QDictionary(
            qlist(numpy.array(['a']), qtype=QSYMBOL_LIST),
            qlist(numpy.array([1], dtype=numpy.int64), qtype=QLONG_LIST)))
    test_reading_one(
        b'1 2!`abc`cdefgh',
        QDictionary(
            qlist(numpy.array([1, 2], dtype=numpy.int64), qtype=QLONG_LIST),
            qlist(numpy.array(['abc', 'cdefgh']), qtype=QSYMBOL_LIST)))
    test_reading_one(
        b'`abc`def`gh!([] one: 1 2 3; two: 4 5 6)',
        QDictionary(
            qlist(numpy.array(['abc', 'def', 'gh']), qtype=QSYMBOL_LIST),
            qtable(qlist(numpy.array(['one', 'two']), qtype=QSYMBOL_LIST), [
                qlist(numpy.array([1, 2, 3]), qtype=QLONG_LIST),
                qlist(numpy.array([4, 5, 6]), qtype=QLONG_LIST)
            ])))
    test_reading_one(
        b'(0 1; 2 3)!`first`second',
        QDictionary([
            qlist(numpy.array([0, 1], dtype=numpy.int64), qtype=QLONG_LIST),
            qlist(numpy.array([2, 3], dtype=numpy.int64), qtype=QLONG_LIST)
        ], qlist(numpy.array(['first', 'second']), qtype=QSYMBOL_LIST)))
    test_reading_one(
        b'(1;2h;3.234;"4")!(`one;2 3;"456";(7;8 9))',
        QDictionary(
            [numpy.int64(1),
             numpy.int16(2),
             numpy.float64(3.234), b'4'], [
                 numpy.string_('one'),
                 qlist(numpy.array([2, 3], dtype=numpy.int64),
                       qtype=QLONG_LIST), b'456',
                 [
                     numpy.int64(7),
                     qlist(numpy.array([8, 9], dtype=numpy.int64),
                           qtype=QLONG_LIST)
                 ]
             ]))
    test_reading_one(
        b'`A`B`C!((1;3.234;3);(`x`y!(`a;2));5.5e)',
        QDictionary(
            qlist(numpy.array(['A', 'B', 'C']), qtype=QSYMBOL_LIST),
            [[numpy.int64(1),
              numpy.float64(3.234),
              numpy.int64(3)],
             QDictionary(qlist(numpy.array(['x', 'y']), qtype=QSYMBOL_LIST),
                         [b'a', numpy.int64(2)]),
             numpy.float32(5.5)]))

    test_reading_one(
        b'flip `abc`def!(1 2 3; 4 5 6)',
        qtable(qlist(numpy.array(['abc', 'def']), qtype=QSYMBOL_LIST), [
            qlist(numpy.array([1, 2, 3]), qtype=QLONG_LIST),
            qlist(numpy.array([4, 5, 6]), qtype=QLONG_LIST)
        ]))
    test_reading_one(
        b'flip `name`iq!(`Dent`Beeblebrox`Prefect;98 42 126)',
        qtable(qlist(numpy.array(['name', 'iq']), qtype=QSYMBOL_LIST), [
            qlist(numpy.array(['Dent', 'Beeblebrox', 'Prefect']),
                  qtype=QSYMBOL_LIST),
            qlist(numpy.array([98, 42, 126]), qtype=QLONG_LIST)
        ]))
    test_reading_one(
        b'flip `name`iq`grade!(`Dent`Beeblebrox`Prefect;98 42 126;"a c")',
        qtable(qlist(numpy.array(['name', 'iq', 'grade']), qtype=QSYMBOL_LIST),
               [
                   qlist(numpy.array(['Dent', 'Beeblebrox', 'Prefect']),
                         qtype=QSYMBOL_LIST),
                   qlist(numpy.array([98, 42, 126]), qtype=QLONG_LIST), b"a c"
               ]))
    test_reading_one(
        b'flip `name`iq`fullname!(`Dent`Beeblebrox`Prefect;98 42 126;("Arthur Dent"; "Zaphod Beeblebrox"; "Ford Prefect"))',
        qtable(
            qlist(numpy.array(['name', 'iq', 'fullname']), qtype=QSYMBOL_LIST),
            [
                qlist(numpy.array(['Dent', 'Beeblebrox', 'Prefect']),
                      qtype=QSYMBOL_LIST),
                qlist(numpy.array([98, 42, 126]), qtype=QLONG_LIST),
                [b"Arthur Dent", b"Zaphod Beeblebrox", b"Ford Prefect"]
            ]))
    test_reading_one(
        b'flip `name`iq`fullname!(`Dent`Beeblebrox`Prefect;98 42 126;("Arthur Dent"; " "; "Ford Prefect"))',
        qtable(
            qlist(numpy.array(['name', 'iq', 'fullname']), qtype=QSYMBOL_LIST),
            [
                qlist(numpy.array(['Dent', 'Beeblebrox', 'Prefect']),
                      qtype=QSYMBOL_LIST),
                qlist(numpy.array([98, 42, 126]), qtype=QLONG_LIST),
                [b"Arthur Dent", b" ", b"Ford Prefect"]
            ]))
    test_reading_one(
        b'([] sc:1 2 3; nsc:(1 2; 3 4; 5 6 7))',
        qtable(qlist(numpy.array(['sc', 'nsc']), qtype=QSYMBOL_LIST), [
            qlist(numpy.array([1, 2, 3]), qtype=QLONG_LIST),
            [
                qlist(numpy.array([1, 2]), qtype=QLONG_LIST),
                qlist(numpy.array([3, 4]), qtype=QLONG_LIST),
                qlist(numpy.array([5, 6, 7]), qtype=QLONG_LIST)
            ]
        ]))
    test_reading_one(
        b'([] sc:1 2 3; nsc:(1 2; 3 4; 5 6))',
        qtable(qlist(numpy.array(['sc', 'nsc']), qtype=QSYMBOL_LIST), [
            qlist(numpy.array([1, 2, 3]), qtype=QLONG_LIST),
            [
                qlist(numpy.array([1, 2]), qtype=QLONG_LIST),
                qlist(numpy.array([3, 4]), qtype=QLONG_LIST),
                qlist(numpy.array([5, 6]), qtype=QLONG_LIST)
            ]
        ]))
    test_reading_one(
        b'1#([] sym:`x`x`x;str:"  a")',
        qtable(qlist(numpy.array(['sym', 'str']), qtype=QSYMBOL_LIST), [
            qlist(numpy.array(['x'], dtype=numpy.string_), qtype=QSYMBOL_LIST),
            b" "
        ]))
    test_reading_one(
        b'-1#([] sym:`x`x`x;str:"  a")',
        qtable(qlist(numpy.array(['sym', 'str']), qtype=QSYMBOL_LIST), [
            qlist(numpy.array(['x'], dtype=numpy.string_), qtype=QSYMBOL_LIST),
            b"a"
        ]))
    test_reading_one(
        b'2#([] sym:`x`x`x`x;str:"  aa")',
        qtable(qlist(numpy.array(['sym', 'str']), qtype=QSYMBOL_LIST), [
            qlist(numpy.array(['x', 'x'], dtype=numpy.string_),
                  qtype=QSYMBOL_LIST), b"  "
        ]))
    test_reading_one(
        b'-2#([] sym:`x`x`x`x;str:"  aa")',
        qtable(qlist(numpy.array(['sym', 'str']), qtype=QSYMBOL_LIST), [
            qlist(numpy.array(['x', 'x'], dtype=numpy.string_),
                  qtype=QSYMBOL_LIST), b"aa"
        ]))
    test_reading_one(
        b'([] name:`symbol$(); iq:`int$())',
        qtable(qlist(numpy.array(['name', 'iq']), qtype=QSYMBOL_LIST), [
            qlist(numpy.array([], dtype=numpy.string_), qtype=QSYMBOL_LIST),
            qlist(numpy.array([]), qtype=QINT_LIST)
        ]))
    test_reading_one(
        b'([] pos:`d1`d2`d3;dates:(2001.01.01;2000.05.01;0Nd))',
        qtable(qlist(numpy.array(['pos', 'dates']), qtype=QSYMBOL_LIST), [
            qlist(numpy.array(['d1', 'd2', 'd3']), qtype=QSYMBOL_LIST),
            qlist(numpy.array([366, 121, qnull(QDATE)]), qtype=QDATE_LIST)
        ]))
    test_reading_one(
        b'([eid:1001 1002 1003] pos:`d1`d2`d3;dates:(2001.01.01;2000.05.01;0Nd))',
        QKeyedTable(
            qtable(qlist(numpy.array(['eid']), qtype=QSYMBOL_LIST),
                   [qlist(numpy.array([1001, 1002, 1003]), qtype=QLONG_LIST)]),
            qtable(qlist(numpy.array(['pos', 'dates']), qtype=QSYMBOL_LIST), [
                qlist(numpy.array(['d1', 'd2', 'd3']), qtype=QSYMBOL_LIST),
                qlist(numpy.array([366, 121, qnull(QDATE)]), qtype=QDATE_LIST)
            ])))