Ejemplo n.º 1
0
 def test_iterate_pattern_varaible_invalid_name(self):
     with self.assertRaises(ValueError):
         list(iterate_pattern("${ }"))
     with self.assertRaises(ValueError):
         list(iterate_pattern("${1A}"))
     with self.assertRaises(ValueError):
         list(iterate_pattern("${!}"))
Ejemplo n.º 2
0
 def test_iterate_pattern_wildcards(self):
     results = list(iterate_pattern("one*?${var}*${s} two "))
     self.assertEquals(results,
                       ["one", "*", "?", "${var}", "*", "${s}", " two "])
     results = list(iterate_pattern("**?${var}middle*?"))
     self.assertEquals(results,
                       ["*", "*", "?", "${var}", "middle", "*", "?"])
Ejemplo n.º 3
0
 def test_iterate_pattern_end_bracket(self):
     with self.assertRaises(ValueError):
         list(iterate_pattern("${value"))
     with self.assertRaises(ValueError):
         list(iterate_pattern("$"))
     with self.assertRaises(ValueError):
         list(iterate_pattern("}${"))
Ejemplo n.º 4
0
 def test_iterate_pattern_escaped_literals(self):
     results = list(iterate_pattern("${?}${*}${$}"))
     self.assertEquals(results, ["${?}", "${*}", "${$}"])
Ejemplo n.º 5
0
 def test_iterate_pattern_varaible_empty_name(self):
     with self.assertRaises(ValueError):
         list(iterate_pattern("${}"))
Ejemplo n.º 6
0
 def test_iterate_pattern_start_bracket(self):
     with self.assertRaises(ValueError):
         list(iterate_pattern("$ {value}"))
     with self.assertRaises(ValueError):
         list(iterate_pattern("$}{"))
Ejemplo n.º 7
0
 def test_iterate_pattern_literal(self):
     result = list(iterate_pattern(" "))
     self.assertEqual(result, [" "])
     result = list(iterate_pattern("1234-56 78.90"))
     self.assertEqual(result, ["1234-56 78.90"])
Ejemplo n.º 8
0
 def test_iterate_pattern_empty_pattern(self):
     result = list(iterate_pattern(""))
     self.assertEqual(result, [])