Spaces:
Runtime error
Runtime error
File size: 699 Bytes
c69cba4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import os
import pytest
import importlib
from qa_engine.response import Response
def test_set_answer():
r = Response()
r.set_answer('Hello, World!')
assert r.get_answer() == 'Hello, World!'
def test_set_sources():
r = Response()
r.set_sources(['source1', 'source1', 'source2'])
assert len(r.get_sources()) == 2
def test_get_sources_as_text():
r = Response()
r.set_sources(['source1', 'source2'])
assert isinstance(r.get_sources_as_text(), str)
def test_get_response_include_sources():
r = Response()
r.set_answer('Hello, World!')
r.set_sources(['source1', 'source2'])
assert len(r.get_answer(include_sources=True)) > len('Hello, World!')
|