Skip to content

Commit 01e2fd3

Browse files
Disable pylint unreachable code warnings in tests
The warnings are triggered by the use of hypothesis.assume() to filter out invalid test cases, which can lead to code paths that are not executed in some test runs. And they have been disabled as the logic is correct. Signed-off-by: Daniel Zullo <daniel.zullo@frequenz.com>
1 parent 52dfae1 commit 01e2fd3

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/test_quantities.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ def test_quantity_divided_by_float(
801801
) -> None:
802802
"""Test the division of all quantities by a float."""
803803
hypothesis.assume(scalar != 0.0)
804-
quantity = quantity_ctor(quantity_value)
804+
quantity = quantity_ctor(quantity_value) # pylint: disable=unreachable
805805
expected_value = quantity.base_value / scalar
806806
print(f"{quantity=}, {expected_value=}")
807807

@@ -837,7 +837,9 @@ def test_quantity_divided_by_self(
837837
"""Test the division of all quantities by a float."""
838838
hypothesis.assume(divisor_value != 0.0)
839839
# We need to have float here because quantity /= divisor will return a float
840-
quantity: Quantity | float = quantity_ctor(quantity_value)
840+
quantity: Quantity | float = quantity_ctor( # pylint: disable=unreachable
841+
quantity_value
842+
)
841843
divisor = quantity_ctor(divisor_value)
842844
assert isinstance(quantity, Quantity)
843845
expected_value = quantity.base_value / divisor.base_value

0 commit comments

Comments
 (0)