示例#1
0
 def test_file_with_uri(self):
     with tempfile.NamedTemporaryFile(delete=False) as tmp:
         tmp.write(song1_uri)
     try:
         uris = parse_m3u(tmp.name, data_dir)
         self.assertEqual([song1_uri], uris)
     finally:
         if os.path.exists(tmp.name):
             os.remove(tmp.name)
示例#2
0
 def test_file_with_uri(self):
     with tempfile.NamedTemporaryFile(delete=False) as tmp:
         tmp.write(song1_uri)
     try:
         uris = parse_m3u(tmp.name, data_dir)
         self.assertEqual([song1_uri], uris)
     finally:
         if os.path.exists(tmp.name):
             os.remove(tmp.name)
示例#3
0
 def test_file_is_relative_to_correct_dir(self):
     with tempfile.NamedTemporaryFile(delete=False) as tmp:
         tmp.write('song1.mp3')
     try:
         uris = parse_m3u(tmp.name, data_dir)
         self.assertEqual([song1_uri], uris)
     finally:
         if os.path.exists(tmp.name):
             os.remove(tmp.name)
示例#4
0
 def test_file_is_relative_to_correct_folder(self):
     with tempfile.NamedTemporaryFile(delete=False) as tmp:
         tmp.write('song1.mp3')
     try:
         uris = parse_m3u(tmp.name, data_dir)
         self.assertEqual([song1_uri], uris)
     finally:
         if os.path.exists(tmp.name):
             os.remove(tmp.name)
示例#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:
         uris = parse_m3u(tmp.name, data_dir)
         self.assertEqual([song1_uri, song2_uri], uris)
     finally:
         if os.path.exists(tmp.name):
             os.remove(tmp.name)
示例#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:
         uris = parse_m3u(tmp.name, data_dir)
         self.assertEqual([song1_uri, song2_uri], uris)
     finally:
         if os.path.exists(tmp.name):
             os.remove(tmp.name)
示例#7
0
 def test_file_with_comment(self):
     uris = parse_m3u(path_to_data_dir('comment.m3u'), data_dir)
     self.assertEqual([song1_uri], uris)
示例#8
0
 def test_basic_file(self):
     uris = parse_m3u(path_to_data_dir('one.m3u'), data_dir)
     self.assertEqual([song1_uri], uris)
示例#9
0
 def test_empty_file(self):
     uris = parse_m3u(path_to_data_dir('empty.m3u'), data_dir)
     self.assertEqual([], uris)
示例#10
0
 def test_open_missing_file(self):
     uris = parse_m3u(path_to_data_dir('non-existant.m3u'), data_dir)
     self.assertEqual([], uris)
示例#11
0
 def test_encoding_is_latin1(self):
     uris = parse_m3u(path_to_data_dir('encoding.m3u'), data_dir)
     self.assertEqual([encoded_uri], uris)
示例#12
0
 def test_encoding_is_latin1(self):
     uris = parse_m3u(data_folder('encoding.m3u'))
     self.assertEqual([encoded_uri], uris)
示例#13
0
 def test_encoding_is_latin1(self):
     uris = parse_m3u(path_to_data_dir('encoding.m3u'), data_dir)
     self.assertEqual([encoded_uri], uris)
示例#14
0
 def test_file_with_comment(self):
     uris = parse_m3u(path_to_data_dir('comment.m3u'), data_dir)
     self.assertEqual([song1_uri], uris)
示例#15
0
 def test_basic_file(self):
     uris = parse_m3u(path_to_data_dir('one.m3u'), data_dir)
     self.assertEqual([song1_uri], uris)
示例#16
0
 def test_empty_file(self):
     uris = parse_m3u(path_to_data_dir('empty.m3u'), data_dir)
     self.assertEqual([], uris)
示例#17
0
 def test_open_missing_file(self):
     uris = parse_m3u(data_folder('non-existant.m3u'))
     self.assertEqual([], uris)
示例#18
0
 def test_basic_file(self):
     uris = parse_m3u(data_folder('one.m3u'))
     self.assertEqual([song1_uri], uris)
示例#19
0
 def test_file_with_comment(self):
     uris = parse_m3u(data_folder('comment.m3u'))
     self.assertEqual([song1_uri], uris)
示例#20
0
 def test_open_missing_file(self):
     uris = parse_m3u(path_to_data_dir('non-existant.m3u'), data_dir)
     self.assertEqual([], uris)
示例#21
0
 def test_empty_file(self):
     uris = parse_m3u(data_folder('empty.m3u'))
     self.assertEqual([], uris)