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')
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'})
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, {})
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'})
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, {})