[MetadataFromField] Improve regex and add tests

This commit is contained in:
pukkandan 2021-04-21 11:12:04 +05:30
parent 8c54a3051d
commit a3faeb7de4
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698
2 changed files with 14 additions and 4 deletions

View file

@ -16,6 +16,15 @@ class TestMetadataFromField(unittest.TestCase):
pp = MetadataFromFieldPP(None, ['title:%(title)s - %(artist)s'])
self.assertEqual(pp._data[0]['regex'], r'(?P<title>.+)\ \-\ (?P<artist>.+)')
def test_field_to_outtmpl(self):
pp = MetadataFromFieldPP(None, ['title:%(title)s : %(artist)s'])
self.assertEqual(pp._data[0]['tmpl'], '%(title)s')
def test_in_out_seperation(self):
pp = MetadataFromFieldPP(None, ['%(title)s \\: %(artist)s:%(title)s : %(artist)s'])
self.assertEqual(pp._data[0]['in'], '%(title)s : %(artist)s')
self.assertEqual(pp._data[0]['out'], '%(title)s : %(artist)s')
class TestMetadataFromTitle(unittest.TestCase):
def test_format_to_regex(self):