mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-07-19 15:01:40 +00:00

* rearrange code * fix tests * relnote * merge test modules * remove extra * rearrange draw tests * forgot * remove unused import
23 lines
606 B
Python
23 lines
606 B
Python
# SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
from haystack.testing.sample_components import Sum
|
|
from haystack.core.serialization import component_to_dict, component_from_dict
|
|
|
|
|
|
def test_sum_receives_no_values():
|
|
component = Sum()
|
|
results = component.run(values=[])
|
|
assert results == {"total": 0}
|
|
|
|
|
|
def test_sum_receives_one_value():
|
|
component = Sum()
|
|
assert component.run(values=[10]) == {"total": 10}
|
|
|
|
|
|
def test_sum_receives_few_values():
|
|
component = Sum()
|
|
assert component.run(values=[10, 2]) == {"total": 12}
|