Ejemplo n.º 1
0
 def test_file_with_uri(self):
     with tempfile.NamedTemporaryFile(delete=False) as tmp:
         tmp.write(song1_uri)
     try:
         tracks = parse_m3u(tmp.name, data_dir)
         self.assertEqual([song1_track], tracks)
     finally:
         if os.path.exists(tmp.name):
             os.remove(tmp.name)
Ejemplo n.º 2
0
 def test_file_is_relative_to_correct_dir(self):
     with tempfile.NamedTemporaryFile(delete=False) as tmp:
         tmp.write('song1.mp3')
     try:
         tracks = parse_m3u(tmp.name, data_dir)
         self.assertEqual([song1_track], tracks)
     finally:
         if os.path.exists(tmp.name):
             os.remove(tmp.name)
Ejemplo n.º 3
0
 def test_file_with_uri(self):
     with tempfile.NamedTemporaryFile(delete=False) as tmp:
         tmp.write(song1_uri)
     try:
         tracks = parse_m3u(tmp.name, data_dir)
         self.assertEqual([song1_track], tracks)
     finally:
         if os.path.exists(tmp.name):
             os.remove(tmp.name)
Ejemplo n.º 4
0
 def test_file_is_relative_to_correct_dir(self):
     with tempfile.NamedTemporaryFile(delete=False) as tmp:
         tmp.write('song1.mp3')
     try:
         tracks = parse_m3u(tmp.name, data_dir)
         self.assertEqual([song1_track], tracks)
     finally:
         if os.path.exists(tmp.name):
             os.remove(tmp.name)
Ejemplo n.º 5
0
 def test_file_with_multiple_absolute_files(self):
     with tempfile.NamedTemporaryFile(delete=False) as tmp:
         tmp.write(song1_path + '\n')
         tmp.write('# comment \n')
         tmp.write(song2_path)
     try:
         tracks = parse_m3u(tmp.name, data_dir)
         self.assertEqual([song1_track, song2_track], tracks)
     finally:
         if os.path.exists(tmp.name):
             os.remove(tmp.name)
Ejemplo n.º 6
0
 def test_file_with_multiple_absolute_files(self):
     with tempfile.NamedTemporaryFile(delete=False) as tmp:
         tmp.write(song1_path + '\n')
         tmp.write('# comment \n')
         tmp.write(song2_path)
     try:
         tracks = parse_m3u(tmp.name, data_dir)
         self.assertEqual([song1_track, song2_track], tracks)
     finally:
         if os.path.exists(tmp.name):
             os.remove(tmp.name)
Ejemplo n.º 7
0
 def test_open_missing_file(self):
     tracks = parse_m3u(path_to_data_dir('non-existant.m3u'), data_dir)
     self.assertEqual([], tracks)
Ejemplo n.º 8
0
 def test_encoding_is_latin1(self):
     tracks = parse_m3u(path_to_data_dir('encoding.m3u'), data_dir)
     self.assertEqual([encoded_track], tracks)
Ejemplo n.º 9
0
 def test_file_with_comment(self):
     tracks = parse_m3u(path_to_data_dir('comment.m3u'), data_dir)
     self.assertEqual([song1_track], tracks)
Ejemplo n.º 10
0
 def test_file_with_comment(self):
     tracks = parse_m3u(path_to_data_dir('comment.m3u'), data_dir)
     self.assertEqual([song1_track], tracks)
Ejemplo n.º 11
0
 def test_basic_ext_file(self):
     tracks = parse_m3u(path_to_data_dir('one-ext.m3u'), data_dir)
     self.assertEqual([song1_ext_track], tracks)
Ejemplo n.º 12
0
 def test_empty_ext_file(self):
     tracks = parse_m3u(path_to_data_dir('empty-ext.m3u'), data_dir)
     self.assertEqual([], tracks)
Ejemplo n.º 13
0
 def test_open_missing_file(self):
     tracks = parse_m3u(path_to_data_dir('non-existant.m3u'), data_dir)
     self.assertEqual([], tracks)
Ejemplo n.º 14
0
 def test_encoding_is_latin1(self):
     tracks = parse_m3u(path_to_data_dir('encoding.m3u'), data_dir)
     self.assertEqual([encoded_track], tracks)
Ejemplo n.º 15
0
 def test_empty_ext_file(self):
     tracks = parse_m3u(path_to_data_dir('empty-ext.m3u'), data_dir)
     self.assertEqual([], tracks)
Ejemplo n.º 16
0
 def test_multi_ext_file(self):
     tracks = parse_m3u(path_to_data_dir('two-ext.m3u'), data_dir)
     self.assertEqual([song1_ext_track, song2_ext_track], tracks)
Ejemplo n.º 17
0
 def test_basic_ext_file(self):
     tracks = parse_m3u(path_to_data_dir('one-ext.m3u'), data_dir)
     self.assertEqual([song1_ext_track], tracks)
Ejemplo n.º 18
0
 def test_multi_ext_file(self):
     tracks = parse_m3u(path_to_data_dir('two-ext.m3u'), data_dir)
     self.assertEqual([song1_ext_track, song2_ext_track], tracks)