Skip to content

Commit 56677fd

Browse files
committed
improved test for distinct
1 parent 73a92f8 commit 56677fd

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

tests/table/test_select.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,21 +285,18 @@ def test_distinct(self):
285285
self.insert_rows()
286286
self.insert_rows()
287287

288-
response = (
289-
Band.select(Band.name).where(Band.name == "Pythonistas").run_sync()
290-
)
288+
query = Band.select(Band.name).where(Band.name == "Pythonistas")
289+
self.assertTrue("DISTINCT" not in query.__str__())
291290

291+
response = query.run_sync()
292292
self.assertTrue(
293293
response == [{"name": "Pythonistas"}, {"name": "Pythonistas"}]
294294
)
295295

296-
response = (
297-
Band.select(Band.name)
298-
.where(Band.name == "Pythonistas")
299-
.distinct()
300-
.run_sync()
301-
)
296+
query = query.distinct()
297+
self.assertTrue("DISTINCT" in query.__str__())
302298

299+
response = query.run_sync()
303300
self.assertTrue(response == [{"name": "Pythonistas"}])
304301

305302
def test_count_group_by(self):

0 commit comments

Comments
 (0)