curds: Add a tags.clear() function
This makes it a little easier to reset the tags before running a new test. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
5469cb9298
commit
f715945536
|
@ -17,7 +17,7 @@ class TestLibraryPlaylist(unittest.TestCase):
|
|||
def setUp(self):
|
||||
library.library_thread.stop()
|
||||
library.library_thread = threadqueue.ThreadQueue()
|
||||
tags.tag_map.clear()
|
||||
tags.clear()
|
||||
|
||||
def tearDownClass():
|
||||
library.library_thread.stop()
|
||||
|
|
|
@ -16,7 +16,7 @@ test_library = os.path.abspath("./trier/Test Library")
|
|||
class TestPlaylistManager(unittest.TestCase):
|
||||
def setUp(self):
|
||||
notify.Notify.clear()
|
||||
tags.tag_map.clear()
|
||||
tags.clear()
|
||||
if not library.library_thread.is_alive():
|
||||
library.library_thread = threadqueue.ThreadQueue()
|
||||
self.cb_plist = None
|
||||
|
|
|
@ -10,7 +10,7 @@ test_library = os.path.abspath("./trier/Test Library")
|
|||
|
||||
class TestPlaylist(unittest.TestCase):
|
||||
def setUp(self):
|
||||
tags.tag_map.clear()
|
||||
tags.clear()
|
||||
notify.Notify.clear()
|
||||
self.cb_plist = None
|
||||
self.cb_track = None
|
||||
|
|
|
@ -80,10 +80,13 @@ class Track(Tag):
|
|||
return None
|
||||
|
||||
|
||||
def save():
|
||||
with data.DataFile("tags.pickle", data.WRITE) as f:
|
||||
f.pickle(tag_map)
|
||||
def clear():
|
||||
tag_map.clear()
|
||||
|
||||
def load():
|
||||
with data.DataFile("tags.pickle", data.READ) as f:
|
||||
tag_map.update(f.unpickle())
|
||||
|
||||
def save():
|
||||
with data.DataFile("tags.pickle", data.WRITE) as f:
|
||||
f.pickle(tag_map)
|
||||
|
|
|
@ -11,7 +11,7 @@ test_tracks = os.path.abspath("./trier/Test Album")
|
|||
class TestTags(unittest.TestCase):
|
||||
def setUp(self):
|
||||
data.DataFile("tags.pickle", data.WRITE).remove()
|
||||
tags.tag_map.clear()
|
||||
tags.clear()
|
||||
|
||||
def test_tags_save_load(self):
|
||||
dfile = data.DataFile("tags.pickle", data.READ)
|
||||
|
@ -25,7 +25,7 @@ class TestTags(unittest.TestCase):
|
|||
tags.save()
|
||||
self.assertTrue(dfile.exists())
|
||||
|
||||
tags.tag_map.clear()
|
||||
tags.clear()
|
||||
self.assertFalse(hash(t) in tags.tag_map)
|
||||
self.assertFalse(hash(t.album) in tags.tag_map)
|
||||
|
||||
|
@ -58,7 +58,7 @@ class TestTags(unittest.TestCase):
|
|||
self.assertTrue(dfile.exists())
|
||||
tag_list = list(tags.tag_map.values())
|
||||
|
||||
tags.tag_map.clear()
|
||||
tags.clear()
|
||||
tags.load()
|
||||
self.assertEqual(len(tags.tag_map), tracks + albums)
|
||||
for tag in tag_list:
|
||||
|
|
|
@ -9,7 +9,7 @@ album_info = {"album" : [ "Test Album" ], "albumartist" : [ "Test Artist" ],
|
|||
class TestAlbumTag(unittest.TestCase):
|
||||
def setUp(self):
|
||||
notify.Notify.clear()
|
||||
tags.tag_map.clear()
|
||||
tags.clear()
|
||||
self.cb_album = None
|
||||
|
||||
def test_album_init_basic(self):
|
||||
|
|
|
@ -9,7 +9,7 @@ test_tracks = os.path.abspath("./trier/Test Album")
|
|||
class TestTrackTag(unittest.TestCase):
|
||||
def setUp(self):
|
||||
notify.Notify.clear()
|
||||
tags.tag_map.clear()
|
||||
tags.clear()
|
||||
self.cb_track = None
|
||||
|
||||
def test_track_init_basic(self):
|
||||
|
|
|
@ -15,7 +15,7 @@ toplevel_plist = [ plist_mgr["Collection"], plist_mgr["Previous"], None, plist_m
|
|||
|
||||
class TestManager(unittest.TestCase):
|
||||
def setUp(self):
|
||||
curds.tags.tag_map.clear()
|
||||
curds.tags.clear()
|
||||
curds.PlaylistManager["Collection"].list.clear()
|
||||
curds.PlaylistManager["Previous"].list.clear()
|
||||
curds.PlaylistManager["Library"].clear()
|
||||
|
|
Loading…
Reference in New Issue