Skip to content

Commit e1c49f2

Browse files
committed
Bad iterator type. closes gh-77
1 parent 351f454 commit e1c49f2

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

tarantool/connection.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -675,11 +675,10 @@ def select(self, space_name, key=None, **kwargs):
675675
index_name = kwargs.get("index", 0)
676676
iterator_type = kwargs.get("iterator")
677677

678-
if iterator_type == None and \
679-
(key == None or (isinstance(key, (list, tuple)) and len(key) == 0)):
680-
iterator_type = ITERATOR_ALL
681-
else:
678+
if iterator_type == None:
682679
iterator_type = ITERATOR_EQ
680+
if (key == None or (isinstance(key, (list, tuple)) and len(key) == 0)):
681+
iterator_type = ITERATOR_ALL
683682

684683
# Perform smart type checking (scalar / list of scalars / list of
685684
# tuples)

tests/suites/test_dml.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ def test_02_select(self):
108108
self.assertEqual(len(self.con.select('space_1', [0], index='secondary', limit=50)), 50)
109109

110110
# TODO: Check iterator_types
111+
self.assertEqual(
112+
self.con.select('space_1', [0, 'tuple_20'], index='secondary', limit=2, iterator=tarantool.const.ITERATOR_GT),
113+
[[200, 0, 'tuple_200'], [205, 0, 'tuple_205']]
114+
)
111115

112116
def test_03_delete(self):
113117
# Check that delete works fine
@@ -170,13 +174,6 @@ def test_07_call(self):
170174
self.assertEqual(len(ans), 1)
171175
self.assertEqual(len(ans[0]), 1)
172176
self.assertIsInstance(ans[0][0], str)
173-
# ans = self.con.call('uuid.hex')
174-
# self.assertEqual(len(ans), 1)
175-
# self.assertEqual(len(ans[0]), 1)
176-
# self.assertIsInstance(ans[0][0], str)
177-
# with self.assertRaisesRegexp(tarantool.DatabaseError,
178-
# '(12345, \'lol, error\')'):
179-
# self.con.call('box.error', [12345, 'lol, error'])
180177

181178
self.assertEqual(self.con.call('box.tuple.new', [1, 2, 3, 'fld_1']), [[1, 2, 3, 'fld_1']])
182179
self.assertEqual(self.con.call('box.tuple.new', 'fld_1'), [['fld_1']])

0 commit comments

Comments
 (0)