示例#1
0
 def test_write_date_field(self):
     # Since `date` is not a MediaField, this should do nothing.
     item = self.add_item_fixture()
     clean_year = item.year
     item.date = 'foo'
     item.write()
     self.assertEqual(MediaFile(syspath(item.path)).year, clean_year)
示例#2
0
 def test_write_date_field(self):
     # Since `date` is not a MediaField, this should do nothing.
     item = self.add_item_fixture()
     clean_year = item.year
     item.date = u'foo'
     item.write()
     self.assertEqual(MediaFile(syspath(item.path)).year, clean_year)
示例#3
0
    def test_write_with_custom_path(self):
        item = self.add_item_fixture()
        custom_path = os.path.join(self.temp_dir, 'custom.mp3')
        shutil.copy(item.path, custom_path)

        item['artist'] = 'new artist'
        self.assertNotEqual(MediaFile(custom_path).artist, 'new artist')
        self.assertNotEqual(MediaFile(item.path).artist, 'new artist')

        item.write(custom_path)
        self.assertEqual(MediaFile(custom_path).artist, 'new artist')
        self.assertNotEqual(MediaFile(item.path).artist, 'new artist')
示例#4
0
    def test_write_with_custom_path(self):
        item = self.add_item_fixture()
        custom_path = os.path.join(self.temp_dir, b"custom.mp3")
        shutil.copy(syspath(item.path), syspath(custom_path))

        item["artist"] = "new artist"
        self.assertNotEqual(MediaFile(custom_path).artist, "new artist")
        self.assertNotEqual(MediaFile(item.path).artist, "new artist")

        item.write(custom_path)
        self.assertEqual(MediaFile(custom_path).artist, "new artist")
        self.assertNotEqual(MediaFile(item.path).artist, "new artist")
示例#5
0
    def test_write_with_custom_path(self):
        item = self.add_item_fixture()
        custom_path = os.path.join(self.temp_dir, 'custom.mp3')
        shutil.copy(syspath(item.path), syspath(custom_path))

        item['artist'] = 'new artist'
        self.assertNotEqual(MediaFile(custom_path).artist, 'new artist')
        self.assertNotEqual(MediaFile(item.path).artist, 'new artist')

        item.write(custom_path)
        self.assertEqual(MediaFile(custom_path).artist, 'new artist')
        self.assertNotEqual(MediaFile(item.path).artist, 'new artist')
示例#6
0
 def test_write_custom_tags(self):
     item = self.add_item_fixture(artist='old artist')
     item.write(tags={'artist': 'new artist'})
     self.assertNotEqual(item.artist, 'new artist')
     self.assertEqual(MediaFile(item.path).artist, 'new artist')
示例#7
0
 def test_write_nonexistant(self):
     item = self.create_item()
     item.path = '/path/does/not/exist'
     with self.assertRaises(beets.library.ReadError):
         item.write()
示例#8
0
 def test_write_custom_tags(self):
     item = self.add_item_fixture(artist='old artist')
     item.write(tags={'artist': 'new artist'})
     self.assertNotEqual(item.artist, 'new artist')
     self.assertEqual(MediaFile(syspath(item.path)).artist, 'new artist')
示例#9
0
 def test_write_nonexistant(self):
     item = self.create_item()
     item.path = b'/path/does/not/exist'
     with self.assertRaises(beets.library.ReadError):
         item.write()
示例#10
0
 def test_write_custom_tags(self):
     item = self.add_item_fixture(artist="old artist")
     item.write(tags={"artist": "new artist"})
     self.assertNotEqual(item.artist, "new artist")
     self.assertEqual(MediaFile(item.path).artist, "new artist")