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:
1
tests/fixtures/generic/m3u-dirty.json
vendored
Normal file
1
tests/fixtures/generic/m3u-dirty.json
vendored
Normal file
File diff suppressed because one or more lines are too long
40621
tests/fixtures/generic/m3u-dirty.m3u
vendored
Normal file
40621
tests/fixtures/generic/m3u-dirty.m3u
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -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()
|
||||
|
Reference in New Issue
Block a user