Skip to content

Commit

Permalink
fix #4: creation of q dictionary with values represented as table
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejlach committed May 26, 2014
1 parent 603b8da commit 74bd8d8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -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]
------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions qpython/qcollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions tests/QExpressions3.out
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions tests/qreader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
4 changes: 4 additions & 0 deletions tests/qwriter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
Expand Down

0 comments on commit 74bd8d8

Please sign in to comment.