Skip to content

Commit 98dec49

Browse files
committed
fixing distinct test
1 parent 54d0a89 commit 98dec49

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

aragorm/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async def run(self, as_dict=True, credentials=None):
8383
# Might try and merge them.
8484
raw = self.response_handler(raw)
8585

86-
output = getattr(self, '_output')
86+
output = getattr(self, '_output', None)
8787
if output and type(raw) is list:
8888
if output.as_list:
8989
if len(raw[0].keys()) != 1:

run-tests.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
#!/bin/bash
2+
# To run all in a folder tests/
3+
# To run all in a file tests/test_foo.py
4+
# To run all in a class tests/test_foo.py::TestFoo
5+
# To run a single test tests/test_foo.py::TestFoo::test_foo
26
python -m pytest -s $1

tests/table/test_select.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ def test_limit(self):
189189

190190
response = Pokemon.select(
191191
'name'
192+
).order_by(
193+
'name'
192194
).limit(
193195
1
194196
).run_sync()
@@ -203,10 +205,10 @@ def test_limit(self):
203205
def test_first(self):
204206
self.insert_rows()
205207

206-
import ipdb; ipdb.set_trace()
207-
208208
response = Pokemon.select(
209209
'name'
210+
).order_by(
211+
'name'
210212
).first().run_sync()
211213

212214
print(f'response = {response}')
@@ -266,6 +268,8 @@ def test_distinct(self):
266268
self.insert_rows()
267269
self.insert_rows()
268270

269-
import ipdb; ipdb.set_trace()
271+
response = Pokemon.select('name').where(
272+
Pokemon.name == 'pikachu'
273+
).distinct().run_sync()
270274

271-
response = Pokemon.select('name').distinct().run_sync()
275+
self.assertTrue(response == [{'name': 'pikachu'}])

0 commit comments

Comments
 (0)