()
| 119 | |
| 120 | |
| 121 | def test_get_component_source(): |
| 122 | haction = HaystackAction( |
| 123 | component=MockComponent(required_init="init"), name="mock", reads=[], writes=[] |
| 124 | ) |
| 125 | |
| 126 | expected_source = """\ |
| 127 | @component |
| 128 | class MockComponent: |
| 129 | def __init__(self, required_init: str, optional_init: str = "default"): |
| 130 | self.required_init = required_init |
| 131 | self.optional_init = optional_init |
| 132 | |
| 133 | @component.output_types(output_1=str, output_2=str) |
| 134 | def run(self, required_input: str, optional_input: str = "default") -> dict: |
| 135 | return { |
| 136 | "output_1": required_input, |
| 137 | "output_2": optional_input, |
| 138 | } |
| 139 | """ |
| 140 | |
| 141 | assert haction.get_source() == expected_source |
| 142 | |
| 143 | |
| 144 | def test_run_with_external_inputs(): |
nothing calls this directly
no test coverage detected