autotyping: --none-return: add a -> None return type to functions without any return, yield, or raise in their body
This commit is contained in:
parent
4e5fe31572
commit
6c3f3afb3a
12 changed files with 184 additions and 182 deletions
|
@ -33,10 +33,10 @@ def load_secrets(): # pragma: no cover
|
|||
|
||||
|
||||
class PyLastTestCase:
|
||||
def assert_startswith(self, s, prefix, start=None, end=None):
|
||||
def assert_startswith(self, s, prefix, start=None, end=None) -> None:
|
||||
assert s.startswith(prefix, start, end)
|
||||
|
||||
def assert_endswith(self, s, suffix, start=None, end=None):
|
||||
def assert_endswith(self, s, suffix, start=None, end=None) -> None:
|
||||
assert s.endswith(suffix, start, end)
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ class TestPyLastWithLastFm(PyLastTestCase):
|
|||
return int(time.time())
|
||||
|
||||
@classmethod
|
||||
def setup_class(cls):
|
||||
def setup_class(cls) -> None:
|
||||
if cls.secrets is None:
|
||||
cls.secrets = load_secrets()
|
||||
|
||||
|
@ -71,7 +71,7 @@ class TestPyLastWithLastFm(PyLastTestCase):
|
|||
password_hash=password_hash,
|
||||
)
|
||||
|
||||
def helper_is_thing_hashable(self, thing):
|
||||
def helper_is_thing_hashable(self, thing) -> None:
|
||||
# Arrange
|
||||
things = set()
|
||||
|
||||
|
@ -82,7 +82,7 @@ class TestPyLastWithLastFm(PyLastTestCase):
|
|||
assert thing is not None
|
||||
assert len(things) == 1
|
||||
|
||||
def helper_validate_results(self, a, b, c):
|
||||
def helper_validate_results(self, a, b, c) -> None:
|
||||
# Assert
|
||||
assert a is not None
|
||||
assert b is not None
|
||||
|
@ -93,7 +93,7 @@ class TestPyLastWithLastFm(PyLastTestCase):
|
|||
assert a == b
|
||||
assert b == c
|
||||
|
||||
def helper_validate_cacheable(self, thing, function_name):
|
||||
def helper_validate_cacheable(self, thing, function_name) -> None:
|
||||
# Arrange
|
||||
# get thing.function_name()
|
||||
func = getattr(thing, function_name, None)
|
||||
|
@ -106,27 +106,27 @@ class TestPyLastWithLastFm(PyLastTestCase):
|
|||
# Assert
|
||||
self.helper_validate_results(result1, result2, result3)
|
||||
|
||||
def helper_at_least_one_thing_in_top_list(self, things, expected_type):
|
||||
def helper_at_least_one_thing_in_top_list(self, things, expected_type) -> None:
|
||||
# Assert
|
||||
assert len(things) > 1
|
||||
assert isinstance(things, list)
|
||||
assert isinstance(things[0], pylast.TopItem)
|
||||
assert isinstance(things[0].item, expected_type)
|
||||
|
||||
def helper_only_one_thing_in_top_list(self, things, expected_type):
|
||||
def helper_only_one_thing_in_top_list(self, things, expected_type) -> None:
|
||||
# Assert
|
||||
assert len(things) == 1
|
||||
assert isinstance(things, list)
|
||||
assert isinstance(things[0], pylast.TopItem)
|
||||
assert isinstance(things[0].item, expected_type)
|
||||
|
||||
def helper_only_one_thing_in_list(self, things, expected_type):
|
||||
def helper_only_one_thing_in_list(self, things, expected_type) -> None:
|
||||
# Assert
|
||||
assert len(things) == 1
|
||||
assert isinstance(things, list)
|
||||
assert isinstance(things[0], expected_type)
|
||||
|
||||
def helper_two_different_things_in_top_list(self, things, expected_type):
|
||||
def helper_two_different_things_in_top_list(self, things, expected_type) -> None:
|
||||
# Assert
|
||||
assert len(things) == 2
|
||||
thing1 = things[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue