From 97780c8891fb5ed055b94e0089d7dd4c13b3f1bc Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 10 Apr 2016 13:52:33 +0300 Subject: [PATCH] Test search_authors --- tests/test_search.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 tests/test_search.py 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() -- 2.39.5