1 # -*- coding: utf-8 -*-
5 import sima.lib.simastr
8 def fuzzystr(sta, stb):
9 afz = sima.lib.simastr.SimaStr(sta)
10 bfz = sima.lib.simastr.SimaStr(stb)
15 class TestSequenceFunctions(unittest.TestCase):
17 def test_fuzzystr(self):
18 sima.lib.simastr.SimaStr.diafilter = False
19 self.assertFalse(fuzzystr('eeee', 'éééé'))
21 ('eeee', 'éééé', self.assertTrue),
22 ('éééé', 'eeee', self.assertTrue),
23 ('The Doors', 'Doors', self.assertTrue),
24 ('Tigres Del Norte', 'Los Tigres Del Norte', self.assertTrue),
25 ( 'The Desert Sessions & PJ Harvey',
26 'Desert Sessions And PJ Harvey',
29 ( 'Smells like teen spirit',
30 'Smells Like Teen Spirits (live)',
33 ('Touché Amoré', 'TOUCHE AMORE', self.assertTrue),
34 ('TOUCHE AMORE', 'Touché Amoré', self.assertTrue),
36 sima.lib.simastr.SimaStr.diafilter = True
37 for sta, stb, assertfunc in tests:
38 assertfunc(fuzzystr(sta, stb), '"{0}" == "{1}"'.format(sta, stb))
40 # vim: ai ts=4 sw=4 sts=4 expandtab