diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f1b48e9..71d570a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,9 @@ +------------------------------------------------------------------------------ + qPython 1.0 Beta 3 [2014.05.26] +------------------------------------------------------------------------------ + + - Fix: creation of q dictionary with values represented as table + ------------------------------------------------------------------------------ qPython 1.0 Beta 2 [2014.05.12] ------------------------------------------------------------------------------ diff --git a/qpython/qcollection.py b/qpython/qcollection.py index b50a497..074bc6f 100644 --- a/qpython/qcollection.py +++ b/qpython/qcollection.py @@ -55,8 +55,8 @@ class QDictionary(object): def __init__(self, keys, values): if not isinstance(keys, (QList, tuple, list)): raise ValueError('%s expects keys to be of type: QList, tuple or list. Actual type: %s' % (self.__class__.__name__, type(keys))) - if not isinstance(values, (QList, tuple, list)): - raise ValueError('%s expects values to be of type: QList, tuple or list. Actual type: %s' % (self.__class__.__name__, type(values))) + if not isinstance(values, (QTable, QList, tuple, list)): + raise ValueError('%s expects values to be of type: QTable, QList, tuple or list. Actual type: %s' % (self.__class__.__name__, type(values))) self.keys = keys self.values = values diff --git a/setup.py b/setup.py index 9fccb2d..99bf4a6 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ setup(name = 'qPython', - version = '1.0 Beta 2', + version = '1.0 Beta 3', description = 'kdb+ interfacing library for Python', author = 'exxeleron', diff --git a/tests/QExpressions3.out b/tests/QExpressions3.out index 50f41bf..8fb62b1 100644 --- a/tests/QExpressions3.out +++ b/tests/QExpressions3.out @@ -142,6 +142,8 @@ ED00000080 630B000100000061000700010000000100000000000000 1 2!`abc`cdefgh 63070002000000010000000000000002000000000000000B00020000006162630063646566676800 +`abc`def`gh!([] one: 1 2 3; two: 4 5 6) +630B000300000061626300646566006768006200630B00020000006F6E650074776F00000002000000070003000000010000000000000002000000000000000300000000000000070003000000040000000000000005000000000000000600000000000000 (`x`y!(`a;2)) 630b000200000078007900000002000000f56100f90200000000000000 (1;2h;3.234;"4")!(`one;2 3;"456";(7;8 9)) diff --git a/tests/qreader_test.py b/tests/qreader_test.py index 861a2de..32eaa7f 100644 --- a/tests/qreader_test.py +++ b/tests/qreader_test.py @@ -101,6 +101,10 @@ qlist(numpy.array([1], dtype=numpy.int64), qtype=QLONG_LIST))), ('1 2!`abc`cdefgh', QDictionary(qlist(numpy.array([1, 2], dtype=numpy.int64), qtype=QLONG_LIST), qlist(numpy.array(['abc', 'cdefgh']), qtype = QSYMBOL_LIST))), + ('`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)]))), ('(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))), ('(1;2h;3.234;"4")!(`one;2 3;"456";(7;8 9))', QDictionary([numpy.int64(1), numpy.int16(2), numpy.float64(3.234), '4'], diff --git a/tests/qwriter_test.py b/tests/qwriter_test.py index ce1345c..ada0fa1 100644 --- a/tests/qwriter_test.py +++ b/tests/qwriter_test.py @@ -124,6 +124,10 @@ qlist(numpy.array([1]), qtype=QLONG_LIST)))), ('1 2!`abc`cdefgh', QDictionary(qlist(numpy.array([1, 2], dtype=numpy.int64), qtype=QLONG_LIST), qlist(numpy.array(['abc', 'cdefgh']), qtype = QSYMBOL_LIST))), + ('`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)]))), ('(`x`y!(`a;2))', QDictionary(qlist(numpy.array(['x', 'y']), qtype = QSYMBOL_LIST), [numpy.string_('a'), numpy.int64(2)])), ('(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)],