mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-07-13 12:00:50 +00:00

* fix docstrings for the builder package * remove dead test * Apply suggestions from code review Co-authored-by: Madeesh Kannan <shadeMe@users.noreply.github.com> * review feedback * pylint --------- Co-authored-by: Madeesh Kannan <shadeMe@users.noreply.github.com>
27 lines
767 B
Python
27 lines
767 B
Python
import pytest
|
|
|
|
from haystack.components.builders.prompt_builder import PromptBuilder
|
|
|
|
|
|
def test_init():
|
|
builder = PromptBuilder(template="This is a {{ variable }}")
|
|
assert builder._template_string == "This is a {{ variable }}"
|
|
|
|
|
|
def test_run():
|
|
builder = PromptBuilder(template="This is a {{ variable }}")
|
|
res = builder.run(variable="test")
|
|
assert res == {"prompt": "This is a test"}
|
|
|
|
|
|
def test_run_without_input():
|
|
builder = PromptBuilder(template="This is a template without input")
|
|
res = builder.run()
|
|
assert res == {"prompt": "This is a template without input"}
|
|
|
|
|
|
def test_run_with_missing_input():
|
|
builder = PromptBuilder(template="This is a {{ variable }}")
|
|
res = builder.run()
|
|
assert res == {"prompt": "This is a "}
|