]> git.phdru.name Git - m_librarian.git/commitdiff
Test search_authors
authorOleg Broytman <phd@phdru.name>
Sun, 10 Apr 2016 10:52:33 +0000 (13:52 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 10 Apr 2016 10:53:30 +0000 (13:53 +0300)
tests/test_search.py [new file with mode: 0755]

diff --git a/tests/test_search.py b/tests/test_search.py
new file mode 100755 (executable)
index 0000000..2ad86c6
--- /dev/null
@@ -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()