def test_parse_version_indicator(self): name = 'p-proj001_s-spec002_d-desc_b003_c0004-0005-0006_f0007.exr' msg = f'Illegal version field indicator in "{name}". Expecting: "v"' with self.assertRaisesRegexp(ParseException, msg): AssetNameParser(self.fields).parse(name)
def test_parse_descriptor_token(self): name = 'p-proj001_s-spec002_d-DeSC_v003_c0004-0005-0006_f0007.exr' msg = f'Illegal descriptor field token in "{name}". Expecting: .*' with self.assertRaisesRegexp(ParseException, msg): AssetNameParser(self.fields).parse(name)
def test_parse_version_single_field(self): name = 'v003' result = AssetNameParser(['version']).parse(name) expected = dict(version=3) self.assertEqual(result, expected)
def test_parse_descriptor_containing_indicators(self): name = 'p-proj001_s-spec002_d-v012-p-banana-f99_v003_c0004-0005-0006_f0007.exr' result = AssetNameParser(self.fields).parse(name)['descriptor'] expected = 'v012-p-banana-f99' self.assertEqual(result, expected)
def test_parse_descriptor_single_field(self): name = 'd-desc003' result = AssetNameParser(['descriptor']).parse(name) expected = dict(descriptor='desc003') self.assertEqual(result, expected)
def test_parse_specification_token(self): name = 'p-proj001_s-002spec_d-desc_v003_c0004-0005-0006_f0007.exr' msg = f'Illegal specification field token in "{name}". Expecting: .*' with self.assertRaisesRegexp(ParseException, msg): AssetNameParser(self.fields).parse(name)
def test_parse_specification_single_field(self): name = 's-spec002' result = AssetNameParser(['specification']).parse(name) expected = dict(specification='spec002') self.assertEqual(result, expected)
def test_parse_project_single_field(self): name = 'p-proj001' result = AssetNameParser(['project']).parse(name) expected = dict(project='proj001') self.assertEqual(result, expected)