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

* rearrange code * fix tests * relnote * merge test modules * remove extra * rearrange draw tests * forgot * remove unused import
25 lines
651 B
Python
25 lines
651 B
Python
# SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
import pytest
|
|
|
|
from haystack.testing.sample_components import Remainder
|
|
from haystack.core.serialization import component_to_dict, component_from_dict
|
|
|
|
|
|
def test_remainder_default():
|
|
component = Remainder()
|
|
results = component.run(value=4)
|
|
assert results == {"remainder_is_1": 4}
|
|
|
|
|
|
def test_remainder_with_divisor():
|
|
component = Remainder(divisor=4)
|
|
results = component.run(value=4)
|
|
assert results == {"remainder_is_0": 4}
|
|
|
|
|
|
def test_remainder_zero():
|
|
with pytest.raises(ValueError):
|
|
Remainder(divisor=0)
|