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)
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)
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')
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")
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')
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')
def test_write_nonexistant(self): item = self.create_item() item.path = '/path/does/not/exist' with self.assertRaises(beets.library.ReadError): item.write()
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')
def test_write_nonexistant(self): item = self.create_item() item.path = b'/path/does/not/exist' with self.assertRaises(beets.library.ReadError): item.write()
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")