summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
authorHannes Ljungberg <hannes@5monkeys.se>2020-05-17 23:20:16 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-05-19 07:46:22 +0200
commit952afc166c8d79013b7181e35aab638145d2adc5 (patch)
tree9eb7e8d129e3df7c682b2ab47dfe86ea8e0dd183 /tests/postgres_tests
parent4029bcd6b20f75a78f9a5829d7826c79aeb20732 (diff)
Fixed #31601 -- Fixed SearchHeadlineTests on PostgresSQL 9.6.18+, 10.13+, 11.8+, and 12.3+.
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r--tests/postgres_tests/test_search.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/postgres_tests/test_search.py b/tests/postgres_tests/test_search.py
index 65ee9ffa20..5e5f0f5544 100644
--- a/tests/postgres_tests/test_search.py
+++ b/tests/postgres_tests/test_search.py
@@ -31,7 +31,7 @@ class GrailTestData:
'Bravely bold Sir Robin, rode forth from Camelot. '
'He was not afraid to die, o Brave Sir Robin. '
'He was not at all afraid to be killed in nasty ways. '
- 'Brave, brave, brave, brave Sir Robin!'
+ 'Brave, brave, brave, brave Sir Robin'
),
(
'He was not in the least bit scared to be mashed into a pulp, '
@@ -578,7 +578,7 @@ class SearchHeadlineTests(GrailTestData, PostgreSQLTestCase):
self.assertEqual(
searched.headline,
'Robin. He was not at all afraid to be <b>killed</b> in nasty '
- 'ways. Brave, brave, brave, brave Sir Robin!',
+ 'ways. Brave, brave, brave, brave Sir Robin',
)
def test_headline_with_config(self):
@@ -641,13 +641,15 @@ class SearchHeadlineTests(GrailTestData, PostgreSQLTestCase):
searched = Line.objects.annotate(
headline=SearchHeadline(
'dialogue',
- SearchQuery('brave sir robin', config='english'),
- short_word=6,
+ SearchQuery('Camelot', config='english'),
+ short_word=5,
+ min_words=8,
),
).get(pk=self.verse0.pk)
- self.assertIs(searched.headline.endswith(
- '<b>Brave</b>, <b>brave</b>, <b>brave</b>, <b>brave</b> <b>Sir</b>'
- ), True)
+ self.assertEqual(searched.headline, (
+ '<b>Camelot</b>. He was not afraid to die, o Brave Sir Robin. He '
+ 'was not at all afraid'
+ ))
def test_headline_fragments_words_options(self):
searched = Line.objects.annotate(