From: Oleg Broytman Date: Sun, 10 Apr 2016 10:52:33 +0000 (+0300) Subject: Test search_authors X-Git-Tag: 0.0.4~19 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=97780c8891fb5ed055b94e0089d7dd4c13b3f1bc;p=m_librarian.git Test search_authors --- diff --git a/tests/test_search.py b/tests/test_search.py new file mode 100755 index 0000000..2ad86c6 --- /dev/null +++ b/tests/test_search.py @@ -0,0 +1,23 @@ +#! /usr/bin/env python +# coding: utf-8 + + +from tests import TestCase, main +from m_librarian.search import search_authors + + +class TestSearch(TestCase): + def test_search_authors(self): + self.import_inpx('test.inpx') + self.assertEqual( + search_authors('exact', True, {'surname': u'Друг'}).count(), 1) + self.assertEqual( + search_authors('start', True, {'surname': u'Друг'}).count(), 2) + self.assertEqual( + search_authors('substring', True, {'surname': u'Друг'}).count(), 2) + self.assertEqual( + search_authors('substring', False, {'surname': u'друг'}).count(), 3) + + +if __name__ == "__main__": + main()