diff --git a/test/plugins/test_art.py b/test/plugins/test_art.py index dfb5374d5..1d8ca7698 100644 --- a/test/plugins/test_art.py +++ b/test/plugins/test_art.py @@ -209,7 +209,7 @@ class FetchImageTest(FetchImageTestCase): def test_invalid_type_returns_none(self): self.mock_response(self.URL, "image/watercolour") self.source.fetch_image(self.candidate, self.settings) - self.assertIsNone(self.candidate.path) + assert self.candidate.path is None def test_jpeg_type_returns_path(self): self.mock_response(self.URL, "image/jpeg") @@ -299,7 +299,7 @@ class CombinedTest(FetchImageTestCase, CAAHelper): def test_main_interface_returns_none_for_missing_asin_and_path(self): album = _common.Bag() candidate = self.plugin.art_for_album(album, None) - self.assertIsNone(candidate) + assert candidate is None def test_main_interface_gives_precedence_to_fs_art(self): _common.touch(os.path.join(self.dpath, b"art.jpg")) @@ -873,7 +873,7 @@ class ArtForAlbumTest(UseThePlugin): self.assertEqual(candidate.path, self.image_file) self.assertExists(candidate.path) else: - self.assertIsNone(candidate) + assert candidate is None def _assert_image_operated(self, image_file, operation, should_operate): self.image_file = image_file diff --git a/test/plugins/test_embedart.py b/test/plugins/test_embedart.py index 1716015c5..d94c34a42 100644 --- a/test/plugins/test_embedart.py +++ b/test/plugins/test_embedart.py @@ -324,18 +324,18 @@ class ArtSimilarityTest(unittest.TestCase): def test_compare_failed(self, mock_extract, mock_subprocess): self._mock_popens(mock_extract, mock_subprocess, 2, "out", "10") - self.assertIsNone(self._similarity(20)) + assert self._similarity(20) is None def test_compare_parsing_error(self, mock_extract, mock_subprocess): self._mock_popens(mock_extract, mock_subprocess, 0, "foo", "bar") - self.assertIsNone(self._similarity(20)) + assert self._similarity(20) is None def test_compare_parsing_error_and_failure( self, mock_extract, mock_subprocess ): self._mock_popens(mock_extract, mock_subprocess, 1, "foo", "bar") - self.assertIsNone(self._similarity(20)) + assert self._similarity(20) is None def test_convert_failure(self, mock_extract, mock_subprocess): self._mock_popens(mock_extract, mock_subprocess, convert_status=1) - self.assertIsNone(self._similarity(20)) + assert self._similarity(20) is None diff --git a/test/plugins/test_fetchart.py b/test/plugins/test_fetchart.py index 86696df2d..f3f189612 100644 --- a/test/plugins/test_fetchart.py +++ b/test/plugins/test_fetchart.py @@ -56,14 +56,14 @@ class FetchartCliTest(PluginTestCase): os.makedirs(os.path.join(self.album.path, b"mycover.jpg")) self.run_command("fetchart") self.album.load() - self.assertIsNone(self.album["artpath"]) + assert self.album["artpath"] is None def test_filesystem_does_not_pick_up_ignored_file(self): self.touch(b"co_ver.jpg", dir=self.album.path, content="IMAGE") self.config["ignore"] = ["*_*"] self.run_command("fetchart") self.album.load() - self.assertIsNone(self.album["artpath"]) + assert self.album["artpath"] is None def test_filesystem_picks_up_non_ignored_file(self): self.touch(b"cover.jpg", dir=self.album.path, content="IMAGE") @@ -80,7 +80,7 @@ class FetchartCliTest(PluginTestCase): self.config["ignore_hidden"] = True self.run_command("fetchart") self.album.load() - self.assertIsNone(self.album["artpath"]) + assert self.album["artpath"] is None def test_filesystem_picks_up_non_hidden_file(self): self.touch(b"cover.jpg", dir=self.album.path, content="IMAGE") diff --git a/test/plugins/test_keyfinder.py b/test/plugins/test_keyfinder.py index ae8243845..5c4faeaba 100644 --- a/test/plugins/test_keyfinder.py +++ b/test/plugins/test_keyfinder.py @@ -74,4 +74,4 @@ class KeyFinderTest(AsIsImporterMixin, PluginMixin, ImportTestCase): self.run_command("keyfinder") item.load() - self.assertIsNone(item["initial_key"]) + assert item["initial_key"] is None diff --git a/test/plugins/test_lyrics.py b/test/plugins/test_lyrics.py index ef2c2f44f..f6fbc44a2 100644 --- a/test/plugins/test_lyrics.py +++ b/test/plugins/test_lyrics.py @@ -481,7 +481,7 @@ class GeniusScrapeLyricsFromHtmlTest(GeniusBaseTest): # expected return value None url = "https://genius.com/sample" mock = MockFetchUrl() - self.assertIsNone(genius._scrape_lyrics_from_html(mock(url))) + assert genius._scrape_lyrics_from_html(mock(url)) is None def test_good_lyrics(self): """Ensure we are able to scrape a page with lyrics""" @@ -550,11 +550,11 @@ class GeniusFetchTest(GeniusBaseTest): mock_scrape.assert_called_with(True) # test no matching artist - self.assertIsNone(genius.fetch("doesntexist", "none")) + assert genius.fetch("doesntexist", "none") is None # test invalid json mock_json.return_value = None - self.assertIsNone(genius.fetch("blackbear", "Idfc")) + assert genius.fetch("blackbear", "Idfc") is None # TODO: add integration test hitting real api @@ -734,7 +734,7 @@ class LRCLibLyricsTest(unittest.TestCase): lyrics = lrclib.fetch("la", "la", "la", 999) - self.assertIsNone(lyrics) + assert lyrics is None @patch("beetsplug.lyrics.requests.get") def test_fetch_exception(self, mock_get): @@ -742,7 +742,7 @@ class LRCLibLyricsTest(unittest.TestCase): lyrics = lrclib.fetch("la", "la", "la", 999) - self.assertIsNone(lyrics) + assert lyrics is None class LRCLibIntegrationTest(LyricsAssertions): @@ -764,12 +764,9 @@ class LRCLibIntegrationTest(LyricsAssertions): ) def test_instrumental_track(self): lyrics = lrclib.fetch( - "Kelly Bailey", - "Black Mesa Inbound", - "Half Life 2 Soundtrack", - 134, + "Kelly Bailey", "Black Mesa Inbound", "Half Life 2 Soundtrack", 134 ) - self.assertIsNone(lyrics) + assert lyrics is None @unittest.skipUnless( os.environ.get("INTEGRATION_TEST", "0") == "1", @@ -777,7 +774,7 @@ class LRCLibIntegrationTest(LyricsAssertions): ) def test_nonexistent_track(self): lyrics = lrclib.fetch("blah", "blah", "blah", 999) - self.assertIsNone(lyrics) + assert lyrics is None # test utilities diff --git a/test/plugins/test_mpdstats.py b/test/plugins/test_mpdstats.py index 91dc253ce..a3bf14242 100644 --- a/test/plugins/test_mpdstats.py +++ b/test/plugins/test_mpdstats.py @@ -43,7 +43,7 @@ class MPDStatsTest(PluginTestCase): mpdstats = MPDStats(self.lib, log) self.assertEqual(str(mpdstats.get_item(item_path)), str(item)) - self.assertIsNone(mpdstats.get_item("/some/non-existing/path")) + assert mpdstats.get_item("/some/non-existing/path") is None self.assertIn("item not found:", log.info.call_args[0][0]) FAKE_UNKNOWN_STATE = "some-unknown-one" diff --git a/test/plugins/test_plugin_mediafield.py b/test/plugins/test_plugin_mediafield.py index 6f933c54c..1275df353 100644 --- a/test/plugins/test_plugin_mediafield.py +++ b/test/plugins/test_plugin_mediafield.py @@ -87,7 +87,7 @@ class ExtendedFieldTestMixin(BeetsTestCase): try: mf = self._mediafile_fixture("empty") - self.assertIsNone(mf.customtag) + assert mf.customtag is None item = Item(path=mf.path, customtag="Gb") item.write() diff --git a/test/plugins/test_replaygain.py b/test/plugins/test_replaygain.py index 348725a6f..bd839a4a1 100644 --- a/test/plugins/test_replaygain.py +++ b/test/plugins/test_replaygain.py @@ -129,11 +129,11 @@ class ReplayGainCliTest: self._add_album(2) for item in self.lib.items(): - self.assertIsNone(item.rg_track_peak) - self.assertIsNone(item.rg_track_gain) + assert item.rg_track_peak is None + assert item.rg_track_gain is None mediafile = MediaFile(item.path) - self.assertIsNone(mediafile.rg_track_peak) - self.assertIsNone(mediafile.rg_track_gain) + assert mediafile.rg_track_peak is None + assert mediafile.rg_track_gain is None self.run_command("replaygain") @@ -169,7 +169,7 @@ class ReplayGainCliTest: item_rg.load() self.assertIsNotNone(item_rg.rg_track_gain) self.assertIsNotNone(item_rg.rg_track_peak) - self.assertIsNone(item_rg.r128_track_gain) + assert item_rg.r128_track_gain is None item_rg.rg_track_gain += 1.0 item_rg.rg_track_peak += 1.0 @@ -180,8 +180,8 @@ class ReplayGainCliTest: if self.has_r128_support: item_r128.load() self.assertIsNotNone(item_r128.r128_track_gain) - self.assertIsNone(item_r128.rg_track_gain) - self.assertIsNone(item_r128.rg_track_peak) + assert item_r128.rg_track_gain is None + assert item_r128.rg_track_peak is None item_r128.r128_track_gain += 1.0 item_r128.store() @@ -228,20 +228,20 @@ class ReplayGainCliTest: self.assertIsNotNone(item_rg.rg_track_gain) self.assertIsNotNone(item_rg.rg_track_peak) # FIXME: Should the plugin null this field? - # self.assertIsNone(item_rg.r128_track_gain) + # assert item_rg.r128_track_gain is None self.assertIsNotNone(item_r128.r128_track_gain) # FIXME: Should the plugin null these fields? - # self.assertIsNone(item_r128.rg_track_gain) - # self.assertIsNone(item_r128.rg_track_peak) + # assert item_r128.rg_track_gain is None + # assert item_r128.rg_track_peak is None def test_cli_saves_album_gain_to_file(self): self._add_album(2) for item in self.lib.items(): mediafile = MediaFile(item.path) - self.assertIsNone(mediafile.rg_album_peak) - self.assertIsNone(mediafile.rg_album_gain) + assert mediafile.rg_album_peak is None + assert mediafile.rg_album_gain is None self.run_command("replaygain", "-a") @@ -274,8 +274,8 @@ class ReplayGainCliTest: for item in album.items(): mediafile = MediaFile(item.path) # does not write REPLAYGAIN_* tags - self.assertIsNone(mediafile.rg_track_gain) - self.assertIsNone(mediafile.rg_album_gain) + assert mediafile.rg_track_gain is None + assert mediafile.rg_album_gain is None # writes R128_* tags self.assertIsNotNone(mediafile.r128_track_gain) self.assertIsNotNone(mediafile.r128_album_gain) diff --git a/test/plugins/test_smartplaylist.py b/test/plugins/test_smartplaylist.py index a60461c16..fe8f3d751 100644 --- a/test/plugins/test_smartplaylist.py +++ b/test/plugins/test_smartplaylist.py @@ -31,8 +31,8 @@ from beetsplug.smartplaylist import SmartPlaylistPlugin class SmartPlaylistTest(BeetsTestCase): def test_build_queries(self): spl = SmartPlaylistPlugin() - self.assertIsNone(spl._matched_playlists) - self.assertIsNone(spl._unmatched_playlists) + assert spl._matched_playlists is None + assert spl._unmatched_playlists is None config["smartplaylist"]["playlists"].set([]) spl.build_queries() diff --git a/test/plugins/test_spotify.py b/test/plugins/test_spotify.py index 646c748da..3fed3f914 100644 --- a/test/plugins/test_spotify.py +++ b/test/plugins/test_spotify.py @@ -50,7 +50,7 @@ class SpotifyPluginTest(BeetsTestCase): assert self.spotify._parse_opts(opts) def test_empty_query(self): - self.assertIsNone(self.spotify._match_library_tracks(self.lib, "1=2")) + assert self.spotify._match_library_tracks(self.lib, "1=2") is None @responses.activate def test_missing_request(self): diff --git a/test/plugins/test_zero.py b/test/plugins/test_zero.py index 9238c4783..582b9dc61 100644 --- a/test/plugins/test_zero.py +++ b/test/plugins/test_zero.py @@ -25,8 +25,8 @@ class ZeroPluginTest(PluginTestCase): item.write() mf = MediaFile(syspath(item.path)) - self.assertIsNone(mf.comments) - self.assertIsNone(mf.month) + assert mf.comments is None + assert mf.month is None self.assertEqual(mf.title, "Title") self.assertEqual(mf.year, 2000) @@ -40,7 +40,7 @@ class ZeroPluginTest(PluginTestCase): item.write() mf = MediaFile(syspath(item.path)) - self.assertIsNone(mf.comments) + assert mf.comments is None def test_pattern_nomatch(self): item = self.add_item_fixture(comments="recorded at place") @@ -112,7 +112,7 @@ class ZeroPluginTest(PluginTestCase): self.assertEqual(item["year"], 2016) self.assertEqual(mf.year, 2016) - self.assertIsNone(mf.comments) + assert mf.comments is None self.assertEqual(item["comments"], "") def test_subcommand_update_database_false(self): @@ -133,7 +133,7 @@ class ZeroPluginTest(PluginTestCase): self.assertEqual(item["year"], 2016) self.assertEqual(mf.year, 2016) self.assertEqual(item["comments"], "test comment") - self.assertIsNone(mf.comments) + assert mf.comments is None def test_subcommand_query_include(self): item = self.add_item_fixture( @@ -150,7 +150,7 @@ class ZeroPluginTest(PluginTestCase): mf = MediaFile(syspath(item.path)) self.assertEqual(mf.year, 2016) - self.assertIsNone(mf.comments) + assert mf.comments is None def test_subcommand_query_exclude(self): item = self.add_item_fixture( @@ -216,7 +216,7 @@ class ZeroPluginTest(PluginTestCase): z = ZeroPlugin() z.write_event(item, item.path, tags) - self.assertIsNone(tags["comments"]) + assert tags["comments"] is None self.assertEqual(tags["year"], 2016) def test_keep_fields_removes_preserved_tags(self): diff --git a/test/test_dbcore.py b/test/test_dbcore.py index ac224a9a6..732bc5e41 100644 --- a/test/test_dbcore.py +++ b/test/test_dbcore.py @@ -364,7 +364,7 @@ class ModelTest(unittest.TestCase): def test_null_value_stays_none_for_untyped_field(self): model = ModelFixture1() model.foo = None - self.assertIsNone(model.foo) + assert model.foo is None def test_normalization_for_typed_flex_fields(self): model = ModelFixture1() @@ -759,6 +759,7 @@ class ResultsIteratorTest(unittest.TestCase): objs[100] def test_no_results(self): - self.assertIsNone( + assert ( self.db._fetch(ModelFixture1, dbcore.query.FalseQuery()).get() + is None ) diff --git a/test/test_files.py b/test/test_files.py index 7287a8b84..64833e6a5 100644 --- a/test/test_files.py +++ b/test/test_files.py @@ -365,7 +365,7 @@ class ArtFileTest(BeetsTestCase): ai = self.lib.add_album((i2,)) i2.move(operation=MoveOperation.COPY) - self.assertIsNone(ai.artpath) + assert ai.artpath is None ai.set_art(newart) self.assertExists(ai.artpath) diff --git a/test/test_importer.py b/test/test_importer.py index 97aa2e73a..4cd2d0896 100644 --- a/test/test_importer.py +++ b/test/test_importer.py @@ -90,8 +90,8 @@ class ScrubbedImportTest(AsIsImporterMixin, PluginMixin, ImportTestCase): for item in self.lib.items(): imported_file = os.path.join(item.path) imported_file = MediaFile(imported_file) - self.assertIsNone(imported_file.artist) - self.assertIsNone(imported_file.album) + assert imported_file.artist is None + assert imported_file.album is None @_common.slow_test() @@ -320,18 +320,18 @@ class ImportSingletonTest(ImportTestCase): self.matcher.restore() def test_apply_asis_adds_track(self): - self.assertIsNone(self.lib.items().get()) + assert self.lib.items().get() is None self.importer.add_choice(importer.action.ASIS) self.importer.run() self.assertEqual(self.lib.items().get().title, "Tag Track 1") def test_apply_asis_does_not_add_album(self): - self.assertIsNone(self.lib.albums().get()) + assert self.lib.albums().get() is None self.importer.add_choice(importer.action.ASIS) self.importer.run() - self.assertIsNone(self.lib.albums().get()) + assert self.lib.albums().get() is None def test_apply_asis_adds_singleton_path(self): self.assert_lib_dir_empty() @@ -341,7 +341,7 @@ class ImportSingletonTest(ImportTestCase): self.assert_file_in_lib(b"singletons", b"Tag Track 1.mp3") def test_apply_candidate_adds_track(self): - self.assertIsNone(self.lib.items().get()) + assert self.lib.items().get() is None self.importer.add_choice(importer.action.APPLY) self.importer.run() @@ -350,7 +350,7 @@ class ImportSingletonTest(ImportTestCase): def test_apply_candidate_does_not_add_album(self): self.importer.add_choice(importer.action.APPLY) self.importer.run() - self.assertIsNone(self.lib.albums().get()) + assert self.lib.albums().get() is None def test_apply_candidate_adds_singleton_path(self): self.assert_lib_dir_empty() @@ -362,7 +362,7 @@ class ImportSingletonTest(ImportTestCase): def test_skip_does_not_add_first_track(self): self.importer.add_choice(importer.action.SKIP) self.importer.run() - self.assertIsNone(self.lib.items().get()) + assert self.lib.items().get() is None def test_skip_adds_other_tracks(self): self.prepare_album_for_import(2) @@ -401,7 +401,7 @@ class ImportSingletonTest(ImportTestCase): } # As-is item import. - self.assertIsNone(self.lib.albums().get()) + assert self.lib.albums().get() is None self.importer.add_choice(importer.action.ASIS) self.importer.run() @@ -414,7 +414,7 @@ class ImportSingletonTest(ImportTestCase): item.remove() # Autotagged. - self.assertIsNone(self.lib.albums().get()) + assert self.lib.albums().get() is None self.importer.clear_choices() self.importer.add_choice(importer.action.APPLY) self.importer.run() @@ -441,14 +441,14 @@ class ImportTest(ImportTestCase): self.matcher.restore() def test_apply_asis_adds_album(self): - self.assertIsNone(self.lib.albums().get()) + assert self.lib.albums().get() is None self.importer.add_choice(importer.action.ASIS) self.importer.run() self.assertEqual(self.lib.albums().get().album, "Tag Album") def test_apply_asis_adds_tracks(self): - self.assertIsNone(self.lib.items().get()) + assert self.lib.items().get() is None self.importer.add_choice(importer.action.ASIS) self.importer.run() self.assertEqual(self.lib.items().get().title, "Tag Track 1") @@ -461,14 +461,14 @@ class ImportTest(ImportTestCase): self.assert_file_in_lib(b"Tag Artist", b"Tag Album", b"Tag Track 1.mp3") def test_apply_candidate_adds_album(self): - self.assertIsNone(self.lib.albums().get()) + assert self.lib.albums().get() is None self.importer.add_choice(importer.action.APPLY) self.importer.run() self.assertEqual(self.lib.albums().get().album, "Applied Album") def test_apply_candidate_adds_tracks(self): - self.assertIsNone(self.lib.items().get()) + assert self.lib.items().get() is None self.importer.add_choice(importer.action.APPLY) self.importer.run() @@ -532,7 +532,7 @@ class ImportTest(ImportTestCase): def test_skip_does_not_add_track(self): self.importer.add_choice(importer.action.SKIP) self.importer.run() - self.assertIsNone(self.lib.items().get()) + assert self.lib.items().get() is None def test_skip_non_album_dirs(self): self.assertIsDir(os.path.join(self.import_dir, b"album")) @@ -569,7 +569,7 @@ class ImportTest(ImportTestCase): self.assertIn(f"No files imported from {import_dir}", logs) def test_asis_no_data_source(self): - self.assertIsNone(self.lib.items().get()) + assert self.lib.items().get() is None self.importer.add_choice(importer.action.ASIS) self.importer.run() @@ -590,7 +590,7 @@ class ImportTest(ImportTestCase): } # As-is album import. - self.assertIsNone(self.lib.albums().get()) + assert self.lib.albums().get() is None self.importer.add_choice(importer.action.ASIS) self.importer.run() @@ -613,7 +613,7 @@ class ImportTest(ImportTestCase): album.remove() # Autotagged. - self.assertIsNone(self.lib.albums().get()) + assert self.lib.albums().get() is None self.importer.clear_choices() self.importer.add_choice(importer.action.APPLY) self.importer.run() @@ -650,15 +650,15 @@ class ImportTracksTest(ImportTestCase): self.matcher.restore() def test_apply_tracks_adds_singleton_track(self): - self.assertIsNone(self.lib.items().get()) - self.assertIsNone(self.lib.albums().get()) + assert self.lib.items().get() is None + assert self.lib.albums().get() is None self.importer.add_choice(importer.action.TRACKS) self.importer.add_choice(importer.action.APPLY) self.importer.add_choice(importer.action.APPLY) self.importer.run() self.assertEqual(self.lib.items().get().title, "Applied Track 1") - self.assertIsNone(self.lib.albums().get()) + assert self.lib.albums().get() is None def test_apply_tracks_adds_singleton_path(self): self.assert_lib_dir_empty() diff --git a/test/test_library.py b/test/test_library.py index 8de2d5b52..fb3744658 100644 --- a/test/test_library.py +++ b/test/test_library.py @@ -129,7 +129,7 @@ class RemoveTest(ItemInDBTestCase): def test_remove_deletes_from_db(self): self.i.remove() c = self.lib._connection().execute("select * from items") - self.assertIsNone(c.fetchone()) + assert c.fetchone() is None class GetSetTest(BeetsTestCase): @@ -163,8 +163,8 @@ class GetSetTest(BeetsTestCase): self.assertNotIn("flex", i.keys(with_album=False)) self.assertEqual(i["flex"], "foo") self.assertEqual(i.get("flex"), "foo") - self.assertIsNone(i.get("flex", with_album=False)) - self.assertIsNone(i.get("flexx")) + assert i.get("flex", with_album=False) is None + assert i.get("flexx") is None class DestinationTest(BeetsTestCase): @@ -964,14 +964,14 @@ class AlbumInfoTest(BeetsTestCase): c.execute("select * from albums where album=?", (self.i.album,)) # Cursor should only return one row. self.assertIsNotNone(c.fetchone()) - self.assertIsNone(c.fetchone()) + assert c.fetchone() is None def test_individual_tracks_have_no_albuminfo(self): i2 = item() i2.album = "aTotallyDifferentAlbum" self.lib.add(i2) ai = self.lib.get_album(i2) - self.assertIsNone(ai) + assert ai is None def test_get_album_by_id(self): ai = self.lib.get_album(self.i) diff --git a/test/test_mb.py b/test/test_mb.py index abe35f520..172e323ee 100644 --- a/test/test_mb.py +++ b/test/test_mb.py @@ -318,7 +318,7 @@ class MBAlbumInfoTest(BeetsTestCase): tracks = [self._make_track("TITLE", "ID", None)] release = self._make_release(tracks=tracks) d = mb.album_info(release) - self.assertIsNone(d.tracks[0].length) + assert d.tracks[0].length is None def test_track_length_overrides_recording_length(self): tracks = [self._make_track("TITLE", "ID", 1.0 * 1000.0)] @@ -415,7 +415,7 @@ class MBAlbumInfoTest(BeetsTestCase): release = self._make_release(None) del release["text-representation"]["language"] d = mb.album_info(release) - self.assertIsNone(d.language) + assert d.language is None def test_parse_recording_artist(self): tracks = [self._make_track("a", "b", 1, True)] @@ -658,7 +658,7 @@ class MBAlbumInfoTest(BeetsTestCase): d = mb.album_info(release) t = d.tracks self.assertEqual(len(t), 2) - self.assertIsNone(t[0].trackdisambig) + assert t[0].trackdisambig is None self.assertEqual(t[1].trackdisambig, "SECOND TRACK") @@ -671,7 +671,7 @@ class ParseIDTest(BeetsTestCase): def test_parse_id_non_id_returns_none(self): id_string = "blah blah" out = mb._parse_id(id_string) - self.assertIsNone(out) + assert out is None def test_parse_id_url_finds_id(self): id_string = "28e32c71-1450-463e-92bf-e0a46446fc11" @@ -981,7 +981,7 @@ class MBLibraryTest(unittest.TestCase): with mock.patch("musicbrainzngs.get_release_by_id") as gp: gp.side_effect = side_effect album = mb.album_for_id("d2a6f856-b553-40a0-ac54-a321e8e2da02") - self.assertIsNone(album.country) + assert album.country is None def test_pseudo_releases_without_links(self): side_effect = [ @@ -1025,7 +1025,7 @@ class MBLibraryTest(unittest.TestCase): with mock.patch("musicbrainzngs.get_release_by_id") as gp: gp.side_effect = side_effect album = mb.album_for_id("d2a6f856-b553-40a0-ac54-a321e8e2da02") - self.assertIsNone(album.country) + assert album.country is None def test_pseudo_releases_with_unsupported_links(self): side_effect = [ @@ -1076,4 +1076,4 @@ class MBLibraryTest(unittest.TestCase): with mock.patch("musicbrainzngs.get_release_by_id") as gp: gp.side_effect = side_effect album = mb.album_for_id("d2a6f856-b553-40a0-ac54-a321e8e2da02") - self.assertIsNone(album.country) + assert album.country is None diff --git a/test/test_plugins.py b/test/test_plugins.py index 2dd216337..d5a542244 100644 --- a/test/test_plugins.py +++ b/test/test_plugins.py @@ -577,7 +577,7 @@ class ParseSpotifyIDTest(unittest.TestCase): def test_parse_id_non_id_returns_none(self): id_string = "blah blah" out = MetadataSourcePlugin._get_id("album", id_string, spotify_id_regex) - self.assertIsNone(out) + assert out is None def test_parse_id_url_finds_id(self): id_string = "39WqpoPgZxygo6YQjehLJJ" @@ -595,7 +595,7 @@ class ParseDeezerIDTest(unittest.TestCase): def test_parse_id_non_id_returns_none(self): id_string = "blah blah" out = MetadataSourcePlugin._get_id("album", id_string, deezer_id_regex) - self.assertIsNone(out) + assert out is None def test_parse_id_url_finds_id(self): id_string = "176356382" @@ -617,7 +617,7 @@ class ParseBeatportIDTest(unittest.TestCase): out = MetadataSourcePlugin._get_id( "album", id_string, beatport_id_regex ) - self.assertIsNone(out) + assert out is None def test_parse_id_url_finds_id(self): id_string = "3089651" diff --git a/test/test_query.py b/test/test_query.py index 63cd04a70..9cbc626f9 100644 --- a/test/test_query.py +++ b/test/test_query.py @@ -74,7 +74,7 @@ class AnyFieldQueryTest(ItemInDBTestCase): q = dbcore.query.AnyFieldQuery( "title", ["artist"], dbcore.query.SubstringQuery ) - self.assertIsNone(self.lib.items(q).get()) + assert self.lib.items(q).get() is None def test_eq(self): q1 = dbcore.query.AnyFieldQuery( @@ -751,12 +751,12 @@ class IntQueryTest(BeetsTestCase): Item._types = {"myint": types.Integer()} self.add_item() matched = self.lib.items("myint:2").get() - self.assertIsNone(matched) + assert matched is None def test_no_substring_match(self): self.add_item(bpm=120) matched = self.lib.items("bpm:12").get() - self.assertIsNone(matched) + assert matched is None class BoolQueryTest(BeetsTestCase, AssertsMixin): diff --git a/test/test_ui.py b/test/test_ui.py index e847b0cda..5c03f515e 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -366,7 +366,7 @@ class ModifyTest(BeetsTestCase): self.modify("initial_key!") mediafile = MediaFile(syspath(item.path)) - self.assertIsNone(mediafile.initial_key) + assert mediafile.initial_key is None def test_arg_parsing_colon_query(self): (query, mods, dels) = commands.modify_parse_args(