Add type hints to core tests (#88478)

This commit is contained in:
epenet 2023-02-20 11:42:56 +01:00 committed by GitHub
parent 26755a6841
commit 5f25b71df7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 1068 additions and 547 deletions

View file

@ -64,7 +64,7 @@ def test_convert_nonnumeric_value() -> None:
(LENGTH_INCHES, 316800.171072),
],
)
def test_convert_from_miles(unit, expected):
def test_convert_from_miles(unit, expected) -> None:
"""Test conversion from miles to other units."""
miles = 5
assert distance_util.convert(miles, LENGTH_MILES, unit) == pytest.approx(expected)
@ -82,7 +82,7 @@ def test_convert_from_miles(unit, expected):
(LENGTH_INCHES, 180.0000972),
],
)
def test_convert_from_yards(unit, expected):
def test_convert_from_yards(unit, expected) -> None:
"""Test conversion from yards to other units."""
yards = 5
assert distance_util.convert(yards, LENGTH_YARD, unit) == pytest.approx(expected)
@ -100,7 +100,7 @@ def test_convert_from_yards(unit, expected):
(LENGTH_INCHES, 60000.032400000004),
],
)
def test_convert_from_feet(unit, expected):
def test_convert_from_feet(unit, expected) -> None:
"""Test conversion from feet to other units."""
feet = 5000
assert distance_util.convert(feet, LENGTH_FEET, unit) == pytest.approx(expected)
@ -118,7 +118,7 @@ def test_convert_from_feet(unit, expected):
(LENGTH_FEET, 416.66668),
],
)
def test_convert_from_inches(unit, expected):
def test_convert_from_inches(unit, expected) -> None:
"""Test conversion from inches to other units."""
inches = 5000
assert distance_util.convert(inches, LENGTH_INCHES, unit) == pytest.approx(expected)
@ -136,7 +136,7 @@ def test_convert_from_inches(unit, expected):
(LENGTH_INCHES, 196850.5),
],
)
def test_convert_from_kilometers(unit, expected):
def test_convert_from_kilometers(unit, expected) -> None:
"""Test conversion from kilometers to other units."""
km = 5
assert distance_util.convert(km, LENGTH_KILOMETERS, unit) == pytest.approx(expected)
@ -154,7 +154,7 @@ def test_convert_from_kilometers(unit, expected):
(LENGTH_INCHES, 196850.5),
],
)
def test_convert_from_meters(unit, expected):
def test_convert_from_meters(unit, expected) -> None:
"""Test conversion from meters to other units."""
m = 5000
assert distance_util.convert(m, LENGTH_METERS, unit) == pytest.approx(expected)
@ -172,7 +172,7 @@ def test_convert_from_meters(unit, expected):
(LENGTH_INCHES, 196850.5),
],
)
def test_convert_from_centimeters(unit, expected):
def test_convert_from_centimeters(unit, expected) -> None:
"""Test conversion from centimeters to other units."""
cm = 500000
assert distance_util.convert(cm, LENGTH_CENTIMETERS, unit) == pytest.approx(
@ -192,7 +192,7 @@ def test_convert_from_centimeters(unit, expected):
(LENGTH_INCHES, 196850.5),
],
)
def test_convert_from_millimeters(unit, expected):
def test_convert_from_millimeters(unit, expected) -> None:
"""Test conversion from millimeters to other units."""
mm = 5000000
assert distance_util.convert(mm, LENGTH_MILLIMETERS, unit) == pytest.approx(