Skip to content

armgit / mwmbl

Public Imported from GitHub
0

An open source, non-profit web search engine

Add a test

Daoud Clarke625ecdccb9a9
diff --git a/test/test_format.py b/test/test_format.py
new file mode 100644
index 0000000..c04e15d
--- /dev/null
+++ b/test/test_format.py
@@ -0,0 +1,19 @@
+
+
+
+from mwmbl.format import format_result
+from mwmbl.tinysearchengine.indexer import Document
+
+
+def test_format_result():
+ result = Document("Something Bananas", "https://something.com", "Insist in Bananas")
+ formatted = format_result(result, "in bananas")
+ assert formatted["title"] == [
+ {"value": "Something ", "is_bold": False},
+ {"value": "Bananas", "is_bold": True},
+ ]
+
+ assert formatted["extract"] == [
+ {"value": "Insist in ", "is_bold": False},
+ {"value": "Bananas", "is_bold": True},
+ ]