From 100239e6cc68450278f0f5c4e8077b587af5218e Mon Sep 17 00:00:00 2001 From: kaliko Date: Thu, 12 Dec 2013 17:08:23 +0100 Subject: [PATCH] Add unit test for Track module --- tests/test_simastr.py | 1 - tests/test_track.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 tests/test_track.py diff --git a/tests/test_simastr.py b/tests/test_simastr.py index c62af39..ebd44f0 100644 --- a/tests/test_simastr.py +++ b/tests/test_simastr.py @@ -31,4 +31,3 @@ class TestSequenceFunctions(unittest.TestCase): assertfunc(fuzzystr(sta, stb), '"{0}" == "{1}"'.format(sta, stb)) # vim: ai ts=4 sw=4 sts=4 expandtab - diff --git a/tests/test_track.py b/tests/test_track.py new file mode 100644 index 0000000..1287784 --- /dev/null +++ b/tests/test_track.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +import unittest + +from sima.lib.track import Track + +DEVOLT = { + 'album': 'Grey', + 'albumartist': ['Devolt', 'Devolt Band'], + 'albumartistsort': 'Devolt', + 'artist': 'Devolt', + 'date': '2011-12-01', + 'disc': '1/1', + 'file': 'gberret.music/Devolt/2011-Grey/03-Devolt - Crazy.mp3', + 'last-modified': '2012-04-02T20:48:59Z', + 'musicbrainz_albumartistid': 'd8e7e3e2-49ab-4f7c-b148-fc946d521f99', + 'musicbrainz_albumid': 'ea2ef2cf-59e1-443a-817e-9066e3e0be4b', + 'musicbrainz_artistid': 'd8e7e3e2-49ab-4f7c-b148-fc946d521f99', + 'musicbrainz_trackid': 'fabf8fc9-2ae5-49c9-8214-a839c958d872', + 'time': '220', + 'title': 'Crazy', + 'track': '3/6'} + + +class TestTrackObject(unittest.TestCase): + + def test_tagcollapse(self): + trk = Track(**DEVOLT) + self.assertTrue(trk.collapse_tags_bool, 'Should have collapsed a tag') + self.assertFalse(isinstance(trk.albumartist, list), 'Failed to collapse albumartist tag') + + def test_boolean_type(self): + self.assertFalse(bool(Track())) + +# vim: ai ts=4 sw=4 sts=4 expandtab -- 2.39.2