]> kaliko git repositories - mpd-sima.git/blob - tests/test_simastr.py
Add unit test for Track module
[mpd-sima.git] / tests / test_simastr.py
1 # -*- coding: utf-8 -*-
2
3 import unittest
4
5 import sima.lib.simastr
6
7
8 def fuzzystr(sta, stb):
9     afz = sima.lib.simastr.SimaStr(sta)
10     bfz = sima.lib.simastr.SimaStr(stb)
11     return afz == bfz
12
13
14
15 class TestSequenceFunctions(unittest.TestCase):
16
17     def test_fuzzystr(self):
18         sima.lib.simastr.SimaStr.diafilter = False
19         self.assertFalse(fuzzystr('eeee', 'éééé'))
20         tests = [
21                 ('eeee', 'éééé', self.assertTrue),
22                 ('The Doors', 'Doors', self.assertTrue),
23                 ('Tigres Del Norte', 'Los Tigres Del Norte', self.assertTrue),
24                 (   'The Desert Sessions & PJ Harvey',
25                     'Desert Sessions And PJ Harvey',
26                     self.assertTrue
27                     ),
28                 ]
29         sima.lib.simastr.SimaStr.diafilter = True
30         for sta, stb, assertfunc in tests:
31             assertfunc(fuzzystr(sta, stb), '"{0}" == "{1}"'.format(sta, stb))
32
33 # vim: ai ts=4 sw=4 sts=4 expandtab