Example #1
0
 def test_raises_SyntaxError_if_no_match(self):
     with self.assertRaises(SyntaxError) as assertion:
         configparser.parse_path_spec(':')
     self.assertEqual(
         str(assertion.exception), 'expecting path spec')
Example #2
0
 def test_name_path_and_types(self):
     name, path, types = configparser.parse_path_spec(
         'name /foobar (foo: bar, baz:quux):')
     self.assertEqual(name, 'name')
     self.assertEqual(path, '/foobar')
     self.assertEqual(types, {'foo': 'bar', 'baz': 'quux'})
Example #3
0
 def test_name_and_path(self):
     name, path, types = configparser.parse_path_spec('name /foobar:')
     self.assertEqual(name, 'name')
     self.assertEqual(path, '/foobar')
     self.assertEqual(types, {})
Example #4
0
 def test_path_and_type(self):
     name, path, types = configparser.parse_path_spec(
         '/foobar (foo: bar):')
     self.assertIs(name, None)
     self.assertEqual(path, '/foobar')
     self.assertEqual(types, {'foo': 'bar'})
Example #5
0
 def test_just_a_path(self):
     name, path, types = configparser.parse_path_spec('/foobar:')
     self.assertIs(name, None)
     self.assertEqual(path, '/foobar')
     self.assertEqual(types, {})