about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorAlexander_Kabui2024-09-03 11:46:39 +0300
committerAlexander_Kabui2024-09-03 11:46:39 +0300
commite80b08c42550aaf6ae014d88d5eaad6c9659f212 (patch)
tree72f77313b3d55a93b1315362eecdab2d146ccd3a /tests
parentdbe79d8a4ca31e23d18b9fdb352dc783c7e0db64 (diff)
downloadgenenetwork3-e80b08c42550aaf6ae014d88d5eaad6c9659f212.tar.gz
Add unittests for formatting bib info.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_llm.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/unit/test_llm.py b/tests/unit/test_llm.py
index c32e888..97365f4 100644
--- a/tests/unit/test_llm.py
+++ b/tests/unit/test_llm.py
@@ -1,7 +1,7 @@
 """Test cases for procedures defined in llms """
 import pytest
 from gn3.llms.process import parse_context
-
+from gn3.llms.process import format_bibliography_info
 
 
 @pytest.mark.unit_test
@@ -32,3 +32,25 @@ def test_parse_context():
     ]
 
     assert parsed_result == expected_result
+
+@pytest.mark.unit_test
+def test_format_bib_info():
+    mock_fahamu_bib_info = [
+         {
+             "author": "J.m",
+             "firstName": "john",
+             "title": "Genes and aging",
+             "year": 2013,
+             "doi": "https://Articles.com/12231"
+         },
+         "2019-Roy-Evaluation of Sirtuin-3 probe quality and co-expressed genes",
+         "2015 - Differential regional and cellular distribution of TFF3 peptide in the human brain.txt"]
+    expected_result = [
+        "J.m.Genes and aging.2013.https://Articles.com/12231 ",
+        "2019-Roy-Evaluation of Sirtuin-3 probe quality and co-expressed genes",
+        "2015 - Differential regional and cellular distribution of TFF3 peptide in the human brain"
+    ]
+
+    assert all([format_bibliography_info(data) == expected
+                for data, expected
+                in zip(mock_fahamu_bib_info, expected_result)])