Source code for tests.chat.llm.test_abs_llm

"""
Test the AbsLlm class.
"""
import unittest

from pykoi.chat.llm.abs_llm import AbsLlm


[docs]class DummyLlm(AbsLlm): """ Dummy class for testing the abstract base class AbsLlm. """
[docs] def predict(self, message: str): return f"Q: {message}, A: N/A."
[docs]class TestAbsLlm(unittest.TestCase): """ Test the AbsLlm class. """
[docs] def test_predict_abstract_method(self): """ Test whether the abstract method `predict` raises NotImplementedError """ test_message = "test" llm = DummyLlm() self.assertEqual(llm.predict(test_message), f"Q: {test_message}, A: N/A.")
[docs] def test_docstring(self): """ Test whether the class has a docstring """ self.assertIsNotNone(AbsLlm.__doc__)
if __name__ == "__main__": unittest.main()