Skip to content

Commit a05e47a

Browse files
committed
use list
1 parent a51b920 commit a05e47a

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

querybuilder/tests/json_tests.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,11 @@ def test_one(self):
105105
record = JsonQueryset(model=MetricRecord).filter(**{'data->two': 'one'}).first()
106106
self.assertIsNone(record)
107107

108-
record = JsonQueryset(model=MetricRecord).filter(**{'data->two': 'two'}).first()
108+
records = list(JsonQueryset(model=MetricRecord).filter(**{'data->two': 'two'}))
109+
self.assertEqual(records[0].data['two'], 'two')
109110

110-
# Django 3.1 changes the raw queryset behavior so querybuilder isn't going to change that behavior
111-
if VERSION[0] == 3 and VERSION[1] == 1:
112-
self.assertEqual(json.loads(record.data)['two'], 'two')
113-
else:
114-
self.assertEqual(record.data['two'], 'two')
115-
116-
record = JsonQueryset(model=MetricRecord).filter(**{'data->one': '1'}).first()
117-
118-
# Django 3.1 changes the raw queryset behavior so querybuilder isn't going to change that behavior
119-
if VERSION[0] == 3 and VERSION[1] == 1:
120-
self.assertEqual(json.loads(record.data)['one'], 1)
121-
else:
122-
self.assertEqual(record.data['one'], 1)
111+
records = list(JsonQueryset(model=MetricRecord).filter(**{'data->one': '1'}))
112+
self.assertEqual(records[0].data['one'], 1)
123113

124114
record = JsonQueryset(model=MetricRecord).filter(**{'data->one': '2'}).first()
125115
self.assertIsNone(record)

0 commit comments

Comments
 (0)