mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +01:00
Replace assertNotIn
This commit is contained in:
parent
11e948121c
commit
6631b6aef6
15 changed files with 64 additions and 64 deletions
|
|
@ -605,7 +605,7 @@ class CoverArtArchiveTest(UseThePlugin, CAAHelper):
|
||||||
candidates = list(self.source.get(album, self.settings, []))
|
candidates = list(self.source.get(album, self.settings, []))
|
||||||
self.assertEqual(len(candidates), 3)
|
self.assertEqual(len(candidates), 3)
|
||||||
for candidate in candidates:
|
for candidate in candidates:
|
||||||
self.assertNotIn(f"-{maxwidth}.jpg", candidate.url)
|
assert f"-{maxwidth}.jpg" not in candidate.url
|
||||||
|
|
||||||
|
|
||||||
class FanartTVTest(UseThePlugin):
|
class FanartTVTest(UseThePlugin):
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ class InfoTest(PluginTestCase):
|
||||||
assert "albumartist: AAA" in out
|
assert "albumartist: AAA" in out
|
||||||
assert "disctitle: DDD" in out
|
assert "disctitle: DDD" in out
|
||||||
assert "genres: a; b; c" in out
|
assert "genres: a; b; c" in out
|
||||||
self.assertNotIn("composer:", out)
|
assert "composer:" not in out
|
||||||
|
|
||||||
def test_item_query(self):
|
def test_item_query(self):
|
||||||
item1, item2 = self.add_item_fixtures(count=2)
|
item1, item2 = self.add_item_fixtures(count=2)
|
||||||
|
|
@ -50,7 +50,7 @@ class InfoTest(PluginTestCase):
|
||||||
assert displayable_path(item1.path) in out
|
assert displayable_path(item1.path) in out
|
||||||
assert "album: xxxx" in out
|
assert "album: xxxx" in out
|
||||||
|
|
||||||
self.assertNotIn(displayable_path(item2.path), out)
|
assert displayable_path(item2.path) not in out
|
||||||
|
|
||||||
def test_item_library_query(self):
|
def test_item_library_query(self):
|
||||||
(item,) = self.add_item_fixtures()
|
(item,) = self.add_item_fixtures()
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class LyricsPluginTest(unittest.TestCase):
|
||||||
|
|
||||||
item = Item(artist="Alice feats Bob", title="song")
|
item = Item(artist="Alice feats Bob", title="song")
|
||||||
assert ("Alice feats Bob", ["song"]) in lyrics.search_pairs(item)
|
assert ("Alice feats Bob", ["song"]) in lyrics.search_pairs(item)
|
||||||
self.assertNotIn(("Alice", ["song"]), lyrics.search_pairs(item))
|
assert ("Alice", ["song"]) not in lyrics.search_pairs(item)
|
||||||
|
|
||||||
item = Item(artist="Alice featuring Bob", title="song")
|
item = Item(artist="Alice featuring Bob", title="song")
|
||||||
assert ("Alice featuring Bob", ["song"]) in lyrics.search_pairs(item)
|
assert ("Alice featuring Bob", ["song"]) in lyrics.search_pairs(item)
|
||||||
|
|
@ -129,8 +129,8 @@ class LyricsPluginTest(unittest.TestCase):
|
||||||
assert ("A", ["Song featuring B"]) in lyrics.search_pairs(item)
|
assert ("A", ["Song featuring B"]) in lyrics.search_pairs(item)
|
||||||
|
|
||||||
item = Item(title="Song and B", artist="A")
|
item = Item(title="Song and B", artist="A")
|
||||||
self.assertNotIn(("A", ["Song"]), lyrics.search_pairs(item))
|
|
||||||
assert ("A", ["Song and B"]) in lyrics.search_pairs(item)
|
assert ("A", ["Song and B"]) in lyrics.search_pairs(item)
|
||||||
|
assert ("A", ["Song"]) not in lyrics.search_pairs(item)
|
||||||
|
|
||||||
item = Item(title="Song: B", artist="A")
|
item = Item(title="Song: B", artist="A")
|
||||||
assert ("A", ["Song"]) in lyrics.search_pairs(item)
|
assert ("A", ["Song"]) in lyrics.search_pairs(item)
|
||||||
|
|
|
||||||
|
|
@ -461,7 +461,7 @@ class BPDQueryTest(BPDTestHelper):
|
||||||
)
|
)
|
||||||
self._assert_ok(*responses)
|
self._assert_ok(*responses)
|
||||||
self.assertEqual("1", responses[1].data["Id"])
|
self.assertEqual("1", responses[1].data["Id"])
|
||||||
self.assertNotIn("Id", responses[3].data)
|
assert "Id" not in responses[3].data
|
||||||
|
|
||||||
def test_cmd_currentsong_tagtypes(self):
|
def test_cmd_currentsong_tagtypes(self):
|
||||||
with self.run_bpd() as client:
|
with self.run_bpd() as client:
|
||||||
|
|
@ -703,7 +703,7 @@ class BPDPlaybackTest(BPDTestHelper):
|
||||||
response = client.send_command("crossfade", "0.5")
|
response = client.send_command("crossfade", "0.5")
|
||||||
self._assert_failed(responses, bpd.ERROR_ARG, pos=3)
|
self._assert_failed(responses, bpd.ERROR_ARG, pos=3)
|
||||||
self._assert_failed(response, bpd.ERROR_ARG)
|
self._assert_failed(response, bpd.ERROR_ARG)
|
||||||
self.assertNotIn("xfade", responses[0].data)
|
assert "xfade" not in responses[0].data
|
||||||
self.assertAlmostEqual(123, int(responses[2].data["xfade"]))
|
self.assertAlmostEqual(123, int(responses[2].data["xfade"]))
|
||||||
|
|
||||||
def test_cmd_mixrampdb(self):
|
def test_cmd_mixrampdb(self):
|
||||||
|
|
@ -723,7 +723,7 @@ class BPDPlaybackTest(BPDTestHelper):
|
||||||
)
|
)
|
||||||
self._assert_failed(responses, bpd.ERROR_ARG, pos=4)
|
self._assert_failed(responses, bpd.ERROR_ARG, pos=4)
|
||||||
self.assertAlmostEqual(2, float(responses[1].data["mixrampdelay"]))
|
self.assertAlmostEqual(2, float(responses[1].data["mixrampdelay"]))
|
||||||
self.assertNotIn("mixrampdelay", responses[3].data)
|
assert "mixrampdelay" not in responses[3].data
|
||||||
|
|
||||||
def test_cmd_setvol(self):
|
def test_cmd_setvol(self):
|
||||||
with self.run_bpd() as client:
|
with self.run_bpd() as client:
|
||||||
|
|
@ -814,7 +814,7 @@ class BPDControlTest(BPDTestHelper):
|
||||||
)
|
)
|
||||||
self._assert_ok(*responses)
|
self._assert_ok(*responses)
|
||||||
self.assertEqual("stop", responses[2].data["state"])
|
self.assertEqual("stop", responses[2].data["state"])
|
||||||
self.assertNotIn("Id", responses[3].data)
|
assert "Id" not in responses[3].data
|
||||||
|
|
||||||
def test_cmd_next(self):
|
def test_cmd_next(self):
|
||||||
with self.run_bpd() as client:
|
with self.run_bpd() as client:
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ class WebPluginTest(ItemInDBTestCase):
|
||||||
res_json = json.loads(response.data.decode("utf-8"))
|
res_json = json.loads(response.data.decode("utf-8"))
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertNotIn("path", res_json)
|
assert "path" not in res_json
|
||||||
|
|
||||||
def test_config_include_artpaths_false(self):
|
def test_config_include_artpaths_false(self):
|
||||||
web.app.config["INCLUDE_PATHS"] = False
|
web.app.config["INCLUDE_PATHS"] = False
|
||||||
|
|
@ -108,7 +108,7 @@ class WebPluginTest(ItemInDBTestCase):
|
||||||
res_json = json.loads(response.data.decode("utf-8"))
|
res_json = json.loads(response.data.decode("utf-8"))
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertNotIn("artpath", res_json)
|
assert "artpath" not in res_json
|
||||||
|
|
||||||
def test_get_all_items(self):
|
def test_get_all_items(self):
|
||||||
response = self.client.get("/item/")
|
response = self.client.get("/item/")
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ class ZeroPluginTest(PluginTestCase):
|
||||||
|
|
||||||
z = ZeroPlugin()
|
z = ZeroPlugin()
|
||||||
|
|
||||||
self.assertNotIn("id", z.fields_to_progs)
|
assert "id" not in z.fields_to_progs
|
||||||
|
|
||||||
def test_fields_removes_preserved_tags(self):
|
def test_fields_removes_preserved_tags(self):
|
||||||
self.config["zero"]["fields"] = ["year id"]
|
self.config["zero"]["fields"] = ["year id"]
|
||||||
|
|
@ -234,7 +234,7 @@ class ZeroPluginTest(PluginTestCase):
|
||||||
|
|
||||||
z = ZeroPlugin()
|
z = ZeroPlugin()
|
||||||
|
|
||||||
self.assertNotIn("id", z.fields_to_progs)
|
assert "id" not in z.fields_to_progs
|
||||||
|
|
||||||
def test_empty_query_n_response_no_changes(self):
|
def test_empty_query_n_response_no_changes(self):
|
||||||
item = self.add_item_fixture(
|
item = self.add_item_fixture(
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ class ArtResizerFileSizeTest(CleanupModulesMixin, BeetsTestCase):
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
with Image.open(path) as img:
|
with Image.open(path) as img:
|
||||||
self.assertNotIn("progression", img.info)
|
assert "progression" not in img.info
|
||||||
|
|
||||||
@unittest.skipUnless(IMBackend.available(), "ImageMagick not available")
|
@unittest.skipUnless(IMBackend.available(), "ImageMagick not available")
|
||||||
def test_im_file_deinterlace(self):
|
def test_im_file_deinterlace(self):
|
||||||
|
|
|
||||||
|
|
@ -316,14 +316,14 @@ class ModelTest(unittest.TestCase):
|
||||||
model["foo"] = "bar"
|
model["foo"] = "bar"
|
||||||
assert "foo" in model
|
assert "foo" in model
|
||||||
del model["foo"]
|
del model["foo"]
|
||||||
self.assertNotIn("foo", model)
|
assert "foo" not in model
|
||||||
|
|
||||||
def test_delete_flexattr_via_dot(self):
|
def test_delete_flexattr_via_dot(self):
|
||||||
model = ModelFixture1()
|
model = ModelFixture1()
|
||||||
model["foo"] = "bar"
|
model["foo"] = "bar"
|
||||||
assert "foo" in model
|
assert "foo" in model
|
||||||
del model.foo
|
del model.foo
|
||||||
self.assertNotIn("foo", model)
|
assert "foo" not in model
|
||||||
|
|
||||||
def test_delete_flexattr_persists(self):
|
def test_delete_flexattr_persists(self):
|
||||||
model = ModelFixture1()
|
model = ModelFixture1()
|
||||||
|
|
@ -336,7 +336,7 @@ class ModelTest(unittest.TestCase):
|
||||||
model.store()
|
model.store()
|
||||||
|
|
||||||
model = self.db._get(ModelFixture1, model.id)
|
model = self.db._get(ModelFixture1, model.id)
|
||||||
self.assertNotIn("foo", model)
|
assert "foo" not in model
|
||||||
|
|
||||||
def test_delete_non_existent_attribute(self):
|
def test_delete_non_existent_attribute(self):
|
||||||
model = ModelFixture1()
|
model = ModelFixture1()
|
||||||
|
|
@ -383,7 +383,7 @@ class ModelTest(unittest.TestCase):
|
||||||
model1.store()
|
model1.store()
|
||||||
|
|
||||||
model2.load()
|
model2.load()
|
||||||
self.assertNotIn("flex_field", model2)
|
assert "flex_field" not in model2
|
||||||
|
|
||||||
def test_check_db_fails(self):
|
def test_check_db_fails(self):
|
||||||
with self.assertRaisesRegex(ValueError, "no database"):
|
with self.assertRaisesRegex(ValueError, "no database"):
|
||||||
|
|
|
||||||
|
|
@ -471,7 +471,7 @@ class ArtFileTest(BeetsTestCase):
|
||||||
self.i.move()
|
self.i.move()
|
||||||
|
|
||||||
artpath = self.lib.albums()[0].artpath
|
artpath = self.lib.albums()[0].artpath
|
||||||
self.assertNotIn(b"different_album", artpath)
|
assert b"different_album" not in artpath
|
||||||
self.assertEqual(artpath, oldartpath)
|
self.assertEqual(artpath, oldartpath)
|
||||||
self.assertExists(oldartpath)
|
self.assertExists(oldartpath)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class LoadTest(ItemInDBTestCase):
|
||||||
self.i.artist = "something"
|
self.i.artist = "something"
|
||||||
assert "artist" in self.i._dirty
|
assert "artist" in self.i._dirty
|
||||||
self.i.load()
|
self.i.load()
|
||||||
self.assertNotIn("artist", self.i._dirty)
|
assert "artist" not in self.i._dirty
|
||||||
|
|
||||||
|
|
||||||
class StoreTest(ItemInDBTestCase):
|
class StoreTest(ItemInDBTestCase):
|
||||||
|
|
@ -78,7 +78,7 @@ class StoreTest(ItemInDBTestCase):
|
||||||
def test_store_clears_dirty_flags(self):
|
def test_store_clears_dirty_flags(self):
|
||||||
self.i.composer = "tvp"
|
self.i.composer = "tvp"
|
||||||
self.i.store()
|
self.i.store()
|
||||||
self.assertNotIn("composer", self.i._dirty)
|
assert "composer" not in self.i._dirty
|
||||||
|
|
||||||
def test_store_album_cascades_flex_deletes(self):
|
def test_store_album_cascades_flex_deletes(self):
|
||||||
album = _common.album()
|
album = _common.album()
|
||||||
|
|
@ -90,8 +90,8 @@ class StoreTest(ItemInDBTestCase):
|
||||||
self.lib.add(item)
|
self.lib.add(item)
|
||||||
del album.flex1
|
del album.flex1
|
||||||
album.store()
|
album.store()
|
||||||
self.assertNotIn("flex1", album)
|
assert "flex1" not in album
|
||||||
self.assertNotIn("flex1", album.items()[0])
|
assert "flex1" not in album.items()[0]
|
||||||
|
|
||||||
|
|
||||||
class AddTest(BeetsTestCase):
|
class AddTest(BeetsTestCase):
|
||||||
|
|
@ -147,7 +147,7 @@ class GetSetTest(BeetsTestCase):
|
||||||
|
|
||||||
def test_set_does_not_dirty_if_value_unchanged(self):
|
def test_set_does_not_dirty_if_value_unchanged(self):
|
||||||
self.i.title = self.i.title
|
self.i.title = self.i.title
|
||||||
self.assertNotIn("title", self.i._dirty)
|
assert "title" not in self.i._dirty
|
||||||
|
|
||||||
def test_invalid_field_raises_attributeerror(self):
|
def test_invalid_field_raises_attributeerror(self):
|
||||||
self.assertRaises(AttributeError, getattr, self.i, "xyzzy")
|
self.assertRaises(AttributeError, getattr, self.i, "xyzzy")
|
||||||
|
|
@ -160,7 +160,7 @@ class GetSetTest(BeetsTestCase):
|
||||||
album.store()
|
album.store()
|
||||||
|
|
||||||
assert "flex" in i
|
assert "flex" in i
|
||||||
self.assertNotIn("flex", i.keys(with_album=False))
|
assert "flex" not in i.keys(with_album=False)
|
||||||
self.assertEqual(i["flex"], "foo")
|
self.assertEqual(i["flex"], "foo")
|
||||||
self.assertEqual(i.get("flex"), "foo")
|
self.assertEqual(i.get("flex"), "foo")
|
||||||
assert i.get("flex", with_album=False) is None
|
assert i.get("flex", with_album=False) is None
|
||||||
|
|
@ -233,13 +233,13 @@ class DestinationTest(BeetsTestCase):
|
||||||
dest = self.i.destination()
|
dest = self.i.destination()
|
||||||
assert b"one" in dest
|
assert b"one" in dest
|
||||||
assert b"two" in dest
|
assert b"two" in dest
|
||||||
self.assertNotIn(b"one/two", dest)
|
assert b"one/two" not in dest
|
||||||
|
|
||||||
def test_destination_escapes_leading_dot(self):
|
def test_destination_escapes_leading_dot(self):
|
||||||
self.i.album = ".something"
|
self.i.album = ".something"
|
||||||
dest = self.i.destination()
|
dest = self.i.destination()
|
||||||
assert b"something" in dest
|
assert b"something" in dest
|
||||||
self.assertNotIn(b"/.something", dest)
|
assert b"/.something" not in dest
|
||||||
|
|
||||||
def test_destination_preserves_legitimate_slashes(self):
|
def test_destination_preserves_legitimate_slashes(self):
|
||||||
self.i.artist = "one"
|
self.i.artist = "one"
|
||||||
|
|
@ -263,10 +263,10 @@ class DestinationTest(BeetsTestCase):
|
||||||
self.i.title = "one \\ two / three.mp3"
|
self.i.title = "one \\ two / three.mp3"
|
||||||
with _common.platform_windows():
|
with _common.platform_windows():
|
||||||
p = self.i.destination()
|
p = self.i.destination()
|
||||||
self.assertNotIn(b"one \\ two", p)
|
assert b"one \\ two" not in p
|
||||||
self.assertNotIn(b"one / two", p)
|
assert b"one / two" not in p
|
||||||
self.assertNotIn(b"two \\ three", p)
|
assert b"two \\ three" not in p
|
||||||
self.assertNotIn(b"two / three", p)
|
assert b"two / three" not in p
|
||||||
|
|
||||||
def test_path_with_format(self):
|
def test_path_with_format(self):
|
||||||
self.lib.path_formats = [("default", "$artist/$album ($format)")]
|
self.lib.path_formats = [("default", "$artist/$album ($format)")]
|
||||||
|
|
@ -427,7 +427,7 @@ class DestinationTest(BeetsTestCase):
|
||||||
self.i.title = "h\u0259d"
|
self.i.title = "h\u0259d"
|
||||||
self.lib.path_formats = [("default", "$title")]
|
self.lib.path_formats = [("default", "$title")]
|
||||||
p = self.i.destination()
|
p = self.i.destination()
|
||||||
self.assertNotIn(b"?", p)
|
assert b"?" not in p
|
||||||
# We use UTF-8 to encode Windows paths now.
|
# We use UTF-8 to encode Windows paths now.
|
||||||
assert "h\u0259d".encode() in p
|
assert "h\u0259d".encode() in p
|
||||||
finally:
|
finally:
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class LoggingLevelTest(AsIsImporterMixin, PluginMixin, ImportTestCase):
|
||||||
self.run_command("dummy")
|
self.run_command("dummy")
|
||||||
assert "dummy: warning cmd" in logs
|
assert "dummy: warning cmd" in logs
|
||||||
assert "dummy: info cmd" in logs
|
assert "dummy: info cmd" in logs
|
||||||
self.assertNotIn("dummy: debug cmd", logs)
|
assert "dummy: debug cmd" not in logs
|
||||||
|
|
||||||
def test_command_level1(self):
|
def test_command_level1(self):
|
||||||
self.config["verbose"] = 1
|
self.config["verbose"] = 1
|
||||||
|
|
@ -111,8 +111,8 @@ class LoggingLevelTest(AsIsImporterMixin, PluginMixin, ImportTestCase):
|
||||||
with helper.capture_log() as logs:
|
with helper.capture_log() as logs:
|
||||||
plugins.send("dummy_event")
|
plugins.send("dummy_event")
|
||||||
assert "dummy: warning listener" in logs
|
assert "dummy: warning listener" in logs
|
||||||
self.assertNotIn("dummy: info listener", logs)
|
assert "dummy: info listener" not in logs
|
||||||
self.assertNotIn("dummy: debug listener", logs)
|
assert "dummy: debug listener" not in logs
|
||||||
|
|
||||||
def test_listener_level1(self):
|
def test_listener_level1(self):
|
||||||
self.config["verbose"] = 1
|
self.config["verbose"] = 1
|
||||||
|
|
@ -120,7 +120,7 @@ class LoggingLevelTest(AsIsImporterMixin, PluginMixin, ImportTestCase):
|
||||||
plugins.send("dummy_event")
|
plugins.send("dummy_event")
|
||||||
assert "dummy: warning listener" in logs
|
assert "dummy: warning listener" in logs
|
||||||
assert "dummy: info listener" in logs
|
assert "dummy: info listener" in logs
|
||||||
self.assertNotIn("dummy: debug listener", logs)
|
assert "dummy: debug listener" not in logs
|
||||||
|
|
||||||
def test_listener_level2(self):
|
def test_listener_level2(self):
|
||||||
self.config["verbose"] = 2
|
self.config["verbose"] = 2
|
||||||
|
|
@ -135,8 +135,8 @@ class LoggingLevelTest(AsIsImporterMixin, PluginMixin, ImportTestCase):
|
||||||
with helper.capture_log() as logs:
|
with helper.capture_log() as logs:
|
||||||
self.run_asis_importer()
|
self.run_asis_importer()
|
||||||
assert "dummy: warning import_stage" in logs
|
assert "dummy: warning import_stage" in logs
|
||||||
self.assertNotIn("dummy: info import_stage", logs)
|
assert "dummy: info import_stage" not in logs
|
||||||
self.assertNotIn("dummy: debug import_stage", logs)
|
assert "dummy: debug import_stage" not in logs
|
||||||
|
|
||||||
def test_import_stage_level1(self):
|
def test_import_stage_level1(self):
|
||||||
self.config["verbose"] = 1
|
self.config["verbose"] = 1
|
||||||
|
|
@ -144,7 +144,7 @@ class LoggingLevelTest(AsIsImporterMixin, PluginMixin, ImportTestCase):
|
||||||
self.run_asis_importer()
|
self.run_asis_importer()
|
||||||
assert "dummy: warning import_stage" in logs
|
assert "dummy: warning import_stage" in logs
|
||||||
assert "dummy: info import_stage" in logs
|
assert "dummy: info import_stage" in logs
|
||||||
self.assertNotIn("dummy: debug import_stage", logs)
|
assert "dummy: debug import_stage" not in logs
|
||||||
|
|
||||||
def test_import_stage_level2(self):
|
def test_import_stage_level2(self):
|
||||||
self.config["verbose"] = 2
|
self.config["verbose"] = 2
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ class ItemTypesTest(PluginLoaderTestCase):
|
||||||
|
|
||||||
# Do not match unset values
|
# Do not match unset values
|
||||||
out = self.run_with_output("ls", "rating:1..3")
|
out = self.run_with_output("ls", "rating:1..3")
|
||||||
self.assertNotIn("aaa", out)
|
assert "aaa" not in out
|
||||||
|
|
||||||
self.run_command("modify", "rating=2", "--yes")
|
self.run_command("modify", "rating=2", "--yes")
|
||||||
|
|
||||||
|
|
@ -99,7 +99,7 @@ class ItemTypesTest(PluginLoaderTestCase):
|
||||||
|
|
||||||
# Don't match out of range
|
# Don't match out of range
|
||||||
out = self.run_with_output("ls", "rating:3..5")
|
out = self.run_with_output("ls", "rating:3..5")
|
||||||
self.assertNotIn("aaa", out)
|
assert "aaa" not in out
|
||||||
|
|
||||||
|
|
||||||
class ItemWriteTest(PluginLoaderTestCase):
|
class ItemWriteTest(PluginLoaderTestCase):
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class AssertsMixin:
|
||||||
|
|
||||||
def assertNotInResult(self, item, results): # noqa
|
def assertNotInResult(self, item, results): # noqa
|
||||||
result_ids = [i.id for i in results]
|
result_ids = [i.id for i in results]
|
||||||
self.assertNotIn(item.id, result_ids)
|
assert item.id not in result_ids
|
||||||
|
|
||||||
|
|
||||||
class AnyFieldQueryTest(ItemInDBTestCase):
|
class AnyFieldQueryTest(ItemInDBTestCase):
|
||||||
|
|
|
||||||
|
|
@ -81,16 +81,16 @@ class ListTest(BeetsTestCase):
|
||||||
|
|
||||||
def test_list_album_omits_title(self):
|
def test_list_album_omits_title(self):
|
||||||
stdout = self._run_list(album=True)
|
stdout = self._run_list(album=True)
|
||||||
self.assertNotIn("the title", stdout.getvalue())
|
assert "the title" not in stdout.getvalue()
|
||||||
|
|
||||||
def test_list_uses_track_artist(self):
|
def test_list_uses_track_artist(self):
|
||||||
stdout = self._run_list()
|
stdout = self._run_list()
|
||||||
assert "the artist" in stdout.getvalue()
|
assert "the artist" in stdout.getvalue()
|
||||||
self.assertNotIn("the album artist", stdout.getvalue())
|
assert "the album artist" not in stdout.getvalue()
|
||||||
|
|
||||||
def test_list_album_uses_album_artist(self):
|
def test_list_album_uses_album_artist(self):
|
||||||
stdout = self._run_list(album=True)
|
stdout = self._run_list(album=True)
|
||||||
self.assertNotIn("the artist", stdout.getvalue())
|
assert "the artist" not in stdout.getvalue()
|
||||||
assert "the album artist" in stdout.getvalue()
|
assert "the album artist" in stdout.getvalue()
|
||||||
|
|
||||||
def test_list_item_format_artist(self):
|
def test_list_item_format_artist(self):
|
||||||
|
|
@ -106,7 +106,7 @@ class ListTest(BeetsTestCase):
|
||||||
def test_list_album_format(self):
|
def test_list_album_format(self):
|
||||||
stdout = self._run_list(album=True, fmt="$genre")
|
stdout = self._run_list(album=True, fmt="$genre")
|
||||||
assert "the genre" in stdout.getvalue()
|
assert "the genre" in stdout.getvalue()
|
||||||
self.assertNotIn("the album", stdout.getvalue())
|
assert "the album" not in stdout.getvalue()
|
||||||
|
|
||||||
|
|
||||||
class RemoveTest(BeetsTestCase):
|
class RemoveTest(BeetsTestCase):
|
||||||
|
|
@ -240,13 +240,13 @@ class ModifyTest(BeetsTestCase):
|
||||||
def test_not_move(self):
|
def test_not_move(self):
|
||||||
self.modify("--nomove", "title=newTitle")
|
self.modify("--nomove", "title=newTitle")
|
||||||
item = self.lib.items().get()
|
item = self.lib.items().get()
|
||||||
self.assertNotIn(b"newTitle", item.path)
|
assert b"newTitle" not in item.path
|
||||||
|
|
||||||
def test_no_write_no_move(self):
|
def test_no_write_no_move(self):
|
||||||
self.modify("--nomove", "--nowrite", "title=newTitle")
|
self.modify("--nomove", "--nowrite", "title=newTitle")
|
||||||
item = self.lib.items().get()
|
item = self.lib.items().get()
|
||||||
item.read()
|
item.read()
|
||||||
self.assertNotIn(b"newTitle", item.path)
|
assert b"newTitle" not in item.path
|
||||||
self.assertNotEqual(item.title, "newTitle")
|
self.assertNotEqual(item.title, "newTitle")
|
||||||
|
|
||||||
def test_update_mtime(self):
|
def test_update_mtime(self):
|
||||||
|
|
@ -323,7 +323,7 @@ class ModifyTest(BeetsTestCase):
|
||||||
self.modify("--nomove", "--album", "album=newAlbum")
|
self.modify("--nomove", "--album", "album=newAlbum")
|
||||||
item = self.lib.items().get()
|
item = self.lib.items().get()
|
||||||
item.read()
|
item.read()
|
||||||
self.assertNotIn(b"newAlbum", item.path)
|
assert b"newAlbum" not in item.path
|
||||||
|
|
||||||
def test_modify_album_formatted(self):
|
def test_modify_album_formatted(self):
|
||||||
item = self.lib.items().get()
|
item = self.lib.items().get()
|
||||||
|
|
@ -352,7 +352,7 @@ class ModifyTest(BeetsTestCase):
|
||||||
|
|
||||||
self.modify("flexattr!")
|
self.modify("flexattr!")
|
||||||
item = self.lib.items().get()
|
item = self.lib.items().get()
|
||||||
self.assertNotIn("flexattr", item)
|
assert "flexattr" not in item
|
||||||
|
|
||||||
@unittest.skip("not yet implemented")
|
@unittest.skip("not yet implemented")
|
||||||
def test_delete_initial_key_tag(self):
|
def test_delete_initial_key_tag(self):
|
||||||
|
|
@ -637,7 +637,7 @@ class UpdateTest(BeetsTestCase):
|
||||||
mf.save()
|
mf.save()
|
||||||
self._update(move=False)
|
self._update(move=False)
|
||||||
item = self.lib.items().get()
|
item = self.lib.items().get()
|
||||||
self.assertNotIn(b"differentTitle", item.path)
|
assert b"differentTitle" not in item.path
|
||||||
|
|
||||||
def test_selective_modified_metadata_moved(self):
|
def test_selective_modified_metadata_moved(self):
|
||||||
mf = MediaFile(syspath(self.i.path))
|
mf = MediaFile(syspath(self.i.path))
|
||||||
|
|
@ -656,7 +656,7 @@ class UpdateTest(BeetsTestCase):
|
||||||
mf.save()
|
mf.save()
|
||||||
self._update(move=False, fields=["title"])
|
self._update(move=False, fields=["title"])
|
||||||
item = self.lib.items().get()
|
item = self.lib.items().get()
|
||||||
self.assertNotIn(b"differentTitle", item.path)
|
assert b"differentTitle" not in item.path
|
||||||
self.assertNotEqual(item.genre, "differentGenre")
|
self.assertNotEqual(item.genre, "differentGenre")
|
||||||
|
|
||||||
def test_modified_album_metadata_moved(self):
|
def test_modified_album_metadata_moved(self):
|
||||||
|
|
@ -694,7 +694,7 @@ class UpdateTest(BeetsTestCase):
|
||||||
mf.save()
|
mf.save()
|
||||||
self._update(move=True, fields=["genre"])
|
self._update(move=True, fields=["genre"])
|
||||||
item = self.lib.items().get()
|
item = self.lib.items().get()
|
||||||
self.assertNotIn(b"differentAlbum", item.path)
|
assert b"differentAlbum" not in item.path
|
||||||
self.assertEqual(item.genre, "differentGenre")
|
self.assertEqual(item.genre, "differentGenre")
|
||||||
|
|
||||||
def test_mtime_match_skips_update(self):
|
def test_mtime_match_skips_update(self):
|
||||||
|
|
@ -1319,7 +1319,7 @@ class ShowChangeTest(BeetsTestCase):
|
||||||
# _common.log.info("Message:{}".format(msg))
|
# _common.log.info("Message:{}".format(msg))
|
||||||
assert "artist: another artist" in msg
|
assert "artist: another artist" in msg
|
||||||
assert " -> the artist" in msg
|
assert " -> the artist" in msg
|
||||||
self.assertNotIn("another album -> the album", msg)
|
assert "another album -> the album" not in msg
|
||||||
|
|
||||||
def test_item_data_change_wrap_column(self):
|
def test_item_data_change_wrap_column(self):
|
||||||
# Patch ui.term_width to force wrapping
|
# Patch ui.term_width to force wrapping
|
||||||
|
|
|
||||||
|
|
@ -52,28 +52,28 @@ class UtilTest(unittest.TestCase):
|
||||||
def test_sanitize_unix_replaces_leading_dot(self):
|
def test_sanitize_unix_replaces_leading_dot(self):
|
||||||
with _common.platform_posix():
|
with _common.platform_posix():
|
||||||
p = util.sanitize_path("one/.two/three")
|
p = util.sanitize_path("one/.two/three")
|
||||||
self.assertNotIn(".", p)
|
assert "." not in p
|
||||||
|
|
||||||
def test_sanitize_windows_replaces_trailing_dot(self):
|
def test_sanitize_windows_replaces_trailing_dot(self):
|
||||||
with _common.platform_windows():
|
with _common.platform_windows():
|
||||||
p = util.sanitize_path("one/two./three")
|
p = util.sanitize_path("one/two./three")
|
||||||
self.assertNotIn(".", p)
|
assert "." not in p
|
||||||
|
|
||||||
def test_sanitize_windows_replaces_illegal_chars(self):
|
def test_sanitize_windows_replaces_illegal_chars(self):
|
||||||
with _common.platform_windows():
|
with _common.platform_windows():
|
||||||
p = util.sanitize_path(':*?"<>|')
|
p = util.sanitize_path(':*?"<>|')
|
||||||
self.assertNotIn(":", p)
|
assert ":" not in p
|
||||||
self.assertNotIn("*", p)
|
assert "*" not in p
|
||||||
self.assertNotIn("?", p)
|
assert "?" not in p
|
||||||
self.assertNotIn('"', p)
|
assert '"' not in p
|
||||||
self.assertNotIn("<", p)
|
assert "<" not in p
|
||||||
self.assertNotIn(">", p)
|
assert ">" not in p
|
||||||
self.assertNotIn("|", p)
|
assert "|" not in p
|
||||||
|
|
||||||
def test_sanitize_windows_replaces_trailing_space(self):
|
def test_sanitize_windows_replaces_trailing_space(self):
|
||||||
with _common.platform_windows():
|
with _common.platform_windows():
|
||||||
p = util.sanitize_path("one/two /three")
|
p = util.sanitize_path("one/two /three")
|
||||||
self.assertNotIn(" ", p)
|
assert " " not in p
|
||||||
|
|
||||||
def test_sanitize_path_works_on_empty_string(self):
|
def test_sanitize_path_works_on_empty_string(self):
|
||||||
with _common.platform_posix():
|
with _common.platform_posix():
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue