Пример #1
0
 def test_and_queries_match_after_sorting(self):
     null = NullQuery()
     any = AnyQuery()
     term = TermQuery("foo")
     field = FieldQuery("x", "y")
     first = AndQuery(null, any, term, field)
     second = AndQuery(any, null, field, term)
     self.assertEqual(first, second)
Пример #2
0
 def test_match_if_query_is_anywhere_in_string(self):
     q = TermQuery('bar')
     self.assertTrue(q.match('foo bar baz'))
Пример #3
0
 def test_failes_if_all_subterms_fail(self):
     q1 = TermQuery("a")
     q2 = TermQuery("b")
     q = OrQuery(q1, q2)
     self.assertFalse(q.match("cd"))
Пример #4
0
 def test_failes_if_at_least_one_subterm_fails(self):
     q1 = TermQuery("a")
     q2 = TermQuery("b")
     q = AndQuery(q1, q2)
     self.assertFalse(q.match("ac"))
Пример #5
0
 def test_matches_if_at_least_one_subterm_matchs(self):
     q1 = TermQuery("a")
     q2 = TermQuery("b")
     q = OrQuery(q1, q2)
     self.assertTrue(q.match("ac"))
Пример #6
0
 def test_spaces_in_query_are_not_stripped(self):
     q = TermQuery('foo bar')
     self.assertFalse(q.match('foobar'))
Пример #7
0
 def test_matches_if_all_subterms_match(self):
     q1 = TermQuery("a")
     q2 = TermQuery("b")
     q = AndQuery(q1, q2)
     self.assertTrue(q.match("ab"))
Пример #8
0
 def test_spaces_in_search_subject_are_not_stripped(self):
     q = TermQuery('oob')
     self.assertFalse(q.match('foo bar baz'))
Пример #9
0
 def test_bad_field_name_returns_term_query(self):
     string = "foo:bar"
     actual = parse(string)
     expected = TermQuery(string)
     self.assertEqual(actual, expected)
Пример #10
0
 def test_parsing_simple_terms(self):
     string = "foo bar"
     expected = TermQuery(string)
     actual = parse(string)
     self.assertEqual(actual, expected)
Пример #11
0
 def test_match_arguments_are_case_insensitive(self):
     q = TermQuery('bar')
     self.assertTrue(q.match('FOO BAR BAZ'))
Пример #12
0
 def test_query_terms_are_case_insensitive(self):
     q = TermQuery('BAR')
     self.assertTrue(q.match('foo bar baz'))