diff options
Diffstat (limited to 'tests/postgres_tests/test_hstore.py')
-rw-r--r-- | tests/postgres_tests/test_hstore.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_hstore.py b/tests/postgres_tests/test_hstore.py index dd8e642ed0..3ac68e1e69 100644 --- a/tests/postgres_tests/test_hstore.py +++ b/tests/postgres_tests/test_hstore.py @@ -5,6 +5,7 @@ import json from django.core import exceptions, serializers from django.db import connection +from django.db.models.expressions import RawSQL from django.forms import Form from django.test.utils import CaptureQueriesContext, modify_settings @@ -14,6 +15,7 @@ from .models import HStoreModel try: from django.contrib.postgres import forms from django.contrib.postgres.fields import HStoreField + from django.contrib.postgres.fields.hstore import KeyTransform from django.contrib.postgres.validators import KeysValidator except ImportError: pass @@ -121,6 +123,13 @@ class TestQuerying(HStoreTestCase): self.objs[:2] ) + def test_key_transform_raw_expression(self): + expr = RawSQL('%s::hstore', ['x => b, y => c']) + self.assertSequenceEqual( + HStoreModel.objects.filter(field__a=KeyTransform('x', expr)), + self.objs[:2] + ) + def test_keys(self): self.assertSequenceEqual( HStoreModel.objects.filter(field__keys=['a']), |