Esempio n. 1
0
 def test_CharIn_should_have_regex_constraint(self):
     value1 = "a"
     value2 = "b"
     self.assertEqual(
         bg_elasticsearch.parse_simple_component([bg_glob.CharIn([value1, value2])]),
         ("regexp", "[ab]"),
     )
 def test_CharIn_should_have_regex_constraint(self):
     value1 = "a"
     value2 = "b"
     self.assertEqual(
         bg_elasticsearch.parse_simple_component([bg_glob.CharIn([value1, value2])]),
         ("regexp", "[ab]"),
     )
Esempio n. 3
0
 def test_SequenceIn_should_have_regexp_constraint_when_there_are_regexp_in_terms(
     self
 ):
     values = ["a", "b*"]
     self.assertEqual(
         bg_elasticsearch.parse_simple_component([bg_glob.SequenceIn(values)]),
         ("regexp", "(a|b*)"),
     )
Esempio n. 4
0
 def test_SequenceIn_should_have_regexp_constraint_when_there_are_regexp_in_terms(
         self):
     values = ["a", "b*"]
     self.assertEqual(
         bg_elasticsearch.parse_simple_component(
             [bg_glob.SequenceIn(values)]),
         ("regexp", "(a|b*)"),
     )
Esempio n. 5
0
 def test_None_component_should_trigger_Error(self):
     with self.assertRaisesRegexp(bg_elasticsearch.Error, "Unhandled type 'None'"):
         bg_elasticsearch.parse_simple_component([None])
Esempio n. 6
0
 def test_Globstar_component_should_trigger_Error(self):
     with self.assertRaisesRegexp(
         bg_elasticsearch.Error, "Unhandled type 'Globstar'"
     ):
         bg_elasticsearch.parse_simple_component([bg_glob.Globstar()])
Esempio n. 7
0
 def test_AnyChar_should_have_wildcard_constraint(self):
     self.assertEqual(
         bg_elasticsearch.parse_simple_component([bg_glob.AnyChar()]),
         ("wildcard", "?"),
     )
Esempio n. 8
0
 def test_string_sequence_should_have_term_constraint(self):
     value = "foo"
     self.assertEqual(
         bg_elasticsearch.parse_simple_component([value]), ("term", value)
     )
Esempio n. 9
0
 def test_any_sequence_should_have_no_constraint(self):
     self.assertEqual(
         bg_elasticsearch.parse_simple_component([bg_glob.AnySequence()]),
         (None, None),
     )
Esempio n. 10
0
 def test_None_component_should_trigger_Error(self):
     with self.assertRaisesRegexp(bg_elasticsearch.Error,
                                  "Unhandled type 'None'"):
         bg_elasticsearch.parse_simple_component([None])
Esempio n. 11
0
 def test_Globstar_component_should_trigger_Error(self):
     with self.assertRaisesRegexp(bg_elasticsearch.Error,
                                  "Unhandled type 'Globstar'"):
         bg_elasticsearch.parse_simple_component([bg_glob.Globstar()])
Esempio n. 12
0
 def test_AnyChar_should_have_wildcard_constraint(self):
     self.assertEqual(
         bg_elasticsearch.parse_simple_component([bg_glob.AnyChar()]),
         ("wildcard", "?"),
     )
Esempio n. 13
0
 def test_string_sequence_should_have_term_constraint(self):
     value = "foo"
     self.assertEqual(bg_elasticsearch.parse_simple_component([value]),
                      ("term", value))
Esempio n. 14
0
 def test_any_sequence_should_have_no_constraint(self):
     self.assertEqual(
         bg_elasticsearch.parse_simple_component([bg_glob.AnySequence()]),
         (None, None),
     )