Skip to content

Commit

Permalink
Added missing tests for transforms usage with subquery for PostgreSQL…
Browse files Browse the repository at this point in the history
… fields
  • Loading branch information
coldmind committed Jun 5, 2015
1 parent e0a8a47 commit 4bd6178
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/postgres_tests/test_array.py
Expand Up @@ -228,6 +228,14 @@ def test_slice_nested(self):
[instance]
)

def test_usage_in_subquery(self):
self.assertSequenceEqual(
NullableIntegerArrayModel.objects.filter(
id__in=NullableIntegerArrayModel.objects.filter(field__len=3)
),
[self.objs[3]]
)


class TestChecks(PostgreSQLTestCase):

Expand Down
6 changes: 6 additions & 0 deletions tests/postgres_tests/test_hstore.py
Expand Up @@ -132,6 +132,12 @@ def test_key_isnull(self):
self.objs[:2]
)

def test_usage_in_subquery(self):
self.assertSequenceEqual(
HStoreModel.objects.filter(id__in=HStoreModel.objects.filter(field__a='b')),
self.objs[:2]
)


class TestSerialization(PostgreSQLTestCase):
test_data = '[{"fields": {"field": "{\\"a\\": \\"b\\"}"}, "model": "postgres_tests.hstoremodel", "pk": null}]'
Expand Down
6 changes: 6 additions & 0 deletions tests/postgres_tests/test_json.py
Expand Up @@ -204,6 +204,12 @@ def test_deep_lookup_transform(self):
[self.objs[7], self.objs[8]]
)

def test_usage_in_subquery(self):
self.assertSequenceEqual(
JSONModel.objects.filter(id__in=JSONModel.objects.filter(field__c=1)),
self.objs[7:9]
)


@skipUnlessPG94
class TestSerialization(TestCase):
Expand Down

0 comments on commit 4bd6178

Please sign in to comment.