diff options
| author | Simon Charette <charette.s@gmail.com> | 2020-02-24 23:48:07 -0500 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-02-26 08:03:46 +0100 |
| commit | d0f1c03331718f1b146cf0fd6ffefa19538eebe4 (patch) | |
| tree | 4025d1dcf1a1bde07d58bccaf8c378582f564b74 /tests | |
| parent | 3d62ddb02695cfafc847951b45e6e1ec5dc0b149 (diff) | |
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.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/postgres_tests/test_search.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/postgres_tests/test_search.py b/tests/postgres_tests/test_search.py index 89aa8c6662..765b846fb3 100644 --- a/tests/postgres_tests/test_search.py +++ b/tests/postgres_tests/test_search.py @@ -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): |
