]> kaliko git repositories - mpd-sima.git/blobdiff - tests/test_meta.py
Add options for album mode (closes #28)
[mpd-sima.git] / tests / test_meta.py
index 071e925cf9e4feda81b5a85359e305700020d717..a615a18e84279034f7dc574fc61502c78af9056a 100644 (file)
@@ -3,7 +3,7 @@
 import unittest
 
 from sima.lib.meta import Meta, Artist, MetaContainer, is_uuid4
-from sima.lib.meta import WrongUUID4, MetaException
+from sima.lib.meta import MetaException, SEPARATOR
 
 VALID = '110e8100-e29b-41d1-a716-116655250000'
 
@@ -11,16 +11,16 @@ class TestMetaObject(unittest.TestCase):
 
     def test_uuid_integrity(self):
         wrong = VALID +'a'
-        self.assertRaises(WrongUUID4, is_uuid4, wrong)
+        self.assertFalse(is_uuid4(wrong))
         #  test UUID4 format validation
-        self.assertRaises(WrongUUID4, is_uuid4, VALID.replace('4', '3'))
-        self.assertRaises(WrongUUID4, is_uuid4, VALID.replace('a', 'z'))
+        self.assertFalse(is_uuid4(VALID.replace('4', '3')))
+        self.assertFalse(is_uuid4(VALID.replace('a', 'z')))
 
     def test_init(self):
         for args in [
                 {'mbid':VALID},
                 {'name': None},
-                {},
+                {'name': 42},
                 ]:
             with self.assertRaises(MetaException,
                                    msg='{} does not raise an except.'.format(args)):
@@ -106,7 +106,7 @@ class TestMetaObject(unittest.TestCase):
 class TestArtistObject(unittest.TestCase):
 
     def test_init(self):
-        artist = {'artist': ', '.join(['Original Name', 'Featuring Nane', 'Featureā€¦']),
+        artist = {'artist': SEPARATOR.join(['Original Name', 'Featuring Nane', 'Featureā€¦']),
                   'albumartist': 'Name',
                   'musicbrainz_artistid': VALID,
                   'musicbrainz_albumartistid': VALID.replace('11', '22'),
@@ -121,6 +121,15 @@ class TestArtistObject(unittest.TestCase):
         art = Artist(**artist)
         self.assertTrue(art.name == 'Original Name', art.name)
 
+    def test_empty_name(self):
+        for args in [
+                {'mbid':VALID},
+                {'name': None},
+                {},
+                ]:
+            with self.assertRaises(MetaException,
+                                   msg='{} does not raise an except.'.format(args)):
+                Artist(**args)
 
 class TestMetaContainers(unittest.TestCase):