Add return type to tests without arguments (#87613)
* Add return type to tests without arguments * Black * Cancel fixture amends
This commit is contained in:
parent
fb4c0b4b7a
commit
4142f0d15d
99 changed files with 473 additions and 459 deletions
|
@ -40,7 +40,7 @@ def test_deprecated_functions(
|
|||
assert convert(value) == expected
|
||||
|
||||
|
||||
def test_convert_same_unit():
|
||||
def test_convert_same_unit() -> None:
|
||||
"""Test conversion from any unit to same unit."""
|
||||
assert volume_util.convert(2, VOLUME_LITERS, VOLUME_LITERS) == 2
|
||||
assert volume_util.convert(3, VOLUME_MILLILITERS, VOLUME_MILLILITERS) == 3
|
||||
|
@ -48,7 +48,7 @@ def test_convert_same_unit():
|
|||
assert volume_util.convert(5, VOLUME_FLUID_OUNCE, VOLUME_FLUID_OUNCE) == 5
|
||||
|
||||
|
||||
def test_convert_invalid_unit():
|
||||
def test_convert_invalid_unit() -> None:
|
||||
"""Test exception is thrown for invalid units."""
|
||||
with pytest.raises(HomeAssistantError, match="is not a recognized .* unit"):
|
||||
volume_util.convert(5, INVALID_SYMBOL, VALID_SYMBOL)
|
||||
|
@ -57,13 +57,13 @@ def test_convert_invalid_unit():
|
|||
volume_util.convert(5, VALID_SYMBOL, INVALID_SYMBOL)
|
||||
|
||||
|
||||
def test_convert_nonnumeric_value():
|
||||
def test_convert_nonnumeric_value() -> None:
|
||||
"""Test exception is thrown for nonnumeric type."""
|
||||
with pytest.raises(TypeError):
|
||||
volume_util.convert("a", VOLUME_GALLONS, VOLUME_LITERS)
|
||||
|
||||
|
||||
def test_convert_from_liters():
|
||||
def test_convert_from_liters() -> None:
|
||||
"""Test conversion from liters to other units."""
|
||||
liters = 5
|
||||
assert volume_util.convert(liters, VOLUME_LITERS, VOLUME_GALLONS) == pytest.approx(
|
||||
|
@ -71,7 +71,7 @@ def test_convert_from_liters():
|
|||
)
|
||||
|
||||
|
||||
def test_convert_from_gallons():
|
||||
def test_convert_from_gallons() -> None:
|
||||
"""Test conversion from gallons to other units."""
|
||||
gallons = 5
|
||||
assert volume_util.convert(gallons, VOLUME_GALLONS, VOLUME_LITERS) == pytest.approx(
|
||||
|
@ -79,7 +79,7 @@ def test_convert_from_gallons():
|
|||
)
|
||||
|
||||
|
||||
def test_convert_from_cubic_meters():
|
||||
def test_convert_from_cubic_meters() -> None:
|
||||
"""Test conversion from cubic meter to other units."""
|
||||
cubic_meters = 5
|
||||
assert volume_util.convert(
|
||||
|
@ -87,7 +87,7 @@ def test_convert_from_cubic_meters():
|
|||
) == pytest.approx(176.5733335)
|
||||
|
||||
|
||||
def test_convert_from_cubic_feet():
|
||||
def test_convert_from_cubic_feet() -> None:
|
||||
"""Test conversion from cubic feet to cubic meters to other units."""
|
||||
cubic_feets = 500
|
||||
assert volume_util.convert(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue