mirror of
https://github.com/django/django.git
synced 2025-07-16 01:35:15 +00:00
Refs #31211 -- Prevented SearchConfig nesting in SearchVector and SearchQuery init.
Passing a SearchConfig instance directly to SearchVector and SearchQuery would result in nested SearchConfig instance.
This commit is contained in:
parent
3d62ddb026
commit
d0f1c03331
2 changed files with 17 additions and 4 deletions
|
@ -6,13 +6,13 @@ All text copyright Python (Monty) Pictures. Thanks to sacred-texts.com for the
|
|||
transcript.
|
||||
"""
|
||||
from django.contrib.postgres.search import (
|
||||
SearchQuery, SearchRank, SearchVector,
|
||||
SearchConfig, SearchQuery, SearchRank, SearchVector,
|
||||
)
|
||||
from django.db import connection
|
||||
from django.db.models import F
|
||||
from django.test import SimpleTestCase, modify_settings, skipUnlessDBFeature
|
||||
|
||||
from . import PostgreSQLTestCase
|
||||
from . import PostgreSQLSimpleTestCase, PostgreSQLTestCase
|
||||
from .models import Character, Line, Scene
|
||||
|
||||
|
||||
|
@ -118,6 +118,13 @@ class SearchVectorFieldTest(GrailTestData, PostgreSQLTestCase):
|
|||
self.assertNotIn('COALESCE(COALESCE', str(searched.query))
|
||||
|
||||
|
||||
class SearchConfigTests(PostgreSQLSimpleTestCase):
|
||||
def test_from_parameter(self):
|
||||
self.assertIsNone(SearchConfig.from_parameter(None))
|
||||
self.assertEqual(SearchConfig.from_parameter('foo'), SearchConfig('foo'))
|
||||
self.assertEqual(SearchConfig.from_parameter(SearchConfig('bar')), SearchConfig('bar'))
|
||||
|
||||
|
||||
class MultipleFieldsTest(GrailTestData, PostgreSQLTestCase):
|
||||
|
||||
def test_simple_on_dialogue(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue