mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 02:19:31 +00:00
Add return type to tests without arguments (#87613)
* Add return type to tests without arguments * Black * Cancel fixture amends
This commit is contained in:
@@ -8,7 +8,7 @@ from homeassistant import util
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
|
||||
def test_raise_if_invalid_filename():
|
||||
def test_raise_if_invalid_filename() -> None:
|
||||
"""Test raise_if_invalid_filename."""
|
||||
assert util.raise_if_invalid_filename("test") is None
|
||||
|
||||
@@ -25,7 +25,7 @@ def test_raise_if_invalid_filename():
|
||||
util.raise_if_invalid_filename("\\../test")
|
||||
|
||||
|
||||
def test_raise_if_invalid_path():
|
||||
def test_raise_if_invalid_path() -> None:
|
||||
"""Test raise_if_invalid_path."""
|
||||
assert util.raise_if_invalid_path("test/path") is None
|
||||
|
||||
@@ -36,7 +36,7 @@ def test_raise_if_invalid_path():
|
||||
assert util.raise_if_invalid_path("~/../test/path")
|
||||
|
||||
|
||||
def test_slugify():
|
||||
def test_slugify() -> None:
|
||||
"""Test slugify."""
|
||||
assert util.slugify("T-!@#$!#@$!$est") == "t_est"
|
||||
assert util.slugify("Test More") == "test_more"
|
||||
@@ -61,7 +61,7 @@ def test_slugify():
|
||||
assert util.slugify(None) == ""
|
||||
|
||||
|
||||
def test_repr_helper():
|
||||
def test_repr_helper() -> None:
|
||||
"""Test repr_helper."""
|
||||
assert util.repr_helper("A") == "A"
|
||||
assert util.repr_helper(5) == "5"
|
||||
@@ -76,7 +76,7 @@ def test_repr_helper():
|
||||
)
|
||||
|
||||
|
||||
def test_convert():
|
||||
def test_convert() -> None:
|
||||
"""Test convert."""
|
||||
assert util.convert("5", int) == 5
|
||||
assert util.convert("5", float) == 5.0
|
||||
@@ -86,13 +86,13 @@ def test_convert():
|
||||
assert util.convert(object, int, 1) == 1
|
||||
|
||||
|
||||
def test_ensure_unique_string():
|
||||
def test_ensure_unique_string() -> None:
|
||||
"""Test ensure_unique_string."""
|
||||
assert util.ensure_unique_string("Beer", ["Beer", "Beer_2"]) == "Beer_3"
|
||||
assert util.ensure_unique_string("Beer", ["Wine", "Soda"]) == "Beer"
|
||||
|
||||
|
||||
def test_throttle():
|
||||
def test_throttle() -> None:
|
||||
"""Test the add cooldown decorator."""
|
||||
calls1 = []
|
||||
calls2 = []
|
||||
@@ -145,7 +145,7 @@ def test_throttle():
|
||||
assert len(calls2) == 2
|
||||
|
||||
|
||||
def test_throttle_per_instance():
|
||||
def test_throttle_per_instance() -> None:
|
||||
"""Test that the throttle method is done per instance of a class."""
|
||||
|
||||
class Tester:
|
||||
@@ -160,7 +160,7 @@ def test_throttle_per_instance():
|
||||
assert Tester().hello()
|
||||
|
||||
|
||||
def test_throttle_on_method():
|
||||
def test_throttle_on_method() -> None:
|
||||
"""Test that throttle works when wrapping a method."""
|
||||
|
||||
class Tester:
|
||||
@@ -177,7 +177,7 @@ def test_throttle_on_method():
|
||||
assert throttled() is None
|
||||
|
||||
|
||||
def test_throttle_on_two_method():
|
||||
def test_throttle_on_two_method() -> None:
|
||||
"""Test that throttle works when wrapping two methods."""
|
||||
|
||||
class Tester:
|
||||
|
||||
Reference in New Issue
Block a user