1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

add m3u tests

This commit is contained in:
Kelly Brazil
2022-07-16 19:43:19 -07:00
parent 5abea6d0c5
commit 26d4bbe9a4
3 changed files with 40634 additions and 0 deletions

View File

@ -13,10 +13,16 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/m3u-example.m3u'), 'r', encoding='utf-8') as f:
self.m3u_example = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/m3u-dirty.m3u'), 'r', encoding='utf-8') as f:
self.m3u_dirty = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/m3u-example.json'), 'r', encoding='utf-8') as f:
self.m3u_example_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/m3u-dirty.json'), 'r', encoding='utf-8') as f:
self.m3u_dirty_json = json.loads(f.read())
def test_m3u_nodata(self):
"""
@ -30,6 +36,12 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.m3u.parse(self.m3u_example, quiet=True), self.m3u_example_json)
def test_m3u_dirty(self):
"""
Test 'm3u' example file with lots of difficult parsing
"""
self.assertEqual(jc.parsers.m3u.parse(self.m3u_dirty, quiet=True), self.m3u_dirty_json)
if __name__ == '__main__':
unittest.main()