From 80f02753babe4736db766a00d4dd152154030080 Mon Sep 17 00:00:00 2001 From: Benedikt Bartscher Date: Thu, 29 Feb 2024 22:52:10 +0100 Subject: [PATCH] add some missing type hints to test state vars --- tests/states/mutation.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/states/mutation.py b/tests/states/mutation.py index 5825b6d12..465514192 100644 --- a/tests/states/mutation.py +++ b/tests/states/mutation.py @@ -10,7 +10,7 @@ class DictMutationTestState(BaseState): """A state for testing ReflexDict mutation.""" # plain dict - details = {"name": "Tommy"} + details: Dict[str, str] = {"name": "Tommy"} def add_age(self): """Add an age to the dict.""" @@ -37,7 +37,7 @@ class DictMutationTestState(BaseState): self.details.pop("age") # dict in list - address = [{"home": "home address"}, {"work": "work address"}] + address: List[Dict[str,str]] = [{"home": "home address"}, {"work": "work address"}] def remove_home_address(self): """Remove the home address from dict in the list.""" @@ -48,7 +48,7 @@ class DictMutationTestState(BaseState): self.address[0]["street"] = "street address" # nested dict - friend_in_nested_dict = {"name": "Nikhil", "friend": {"name": "Alek"}} + friend_in_nested_dict: Dict[str, Union[str, Dict[str,str]]] = {"name": "Nikhil", "friend": {"name": "Alek"}} def change_friend_name(self): """Change the friend's name in the nested dict.""" @@ -67,7 +67,7 @@ class ListMutationTestState(BaseState): """A state for testing ReflexList mutation.""" # plain list - plain_friends = ["Tommy"] + plain_friends: List[str] = ["Tommy"] def make_friend(self): """Add a friend to the list.""" @@ -99,7 +99,7 @@ class ListMutationTestState(BaseState): self.plain_friends.remove("Tommy") # list in dict - friends_in_dict = {"Tommy": ["Jenny"]} + friends_in_dict: Dict[str, List[str]] = {"Tommy": ["Jenny"]} def remove_jenny_from_tommy(self): """Remove Jenny from Tommy's friends list.""" @@ -114,7 +114,7 @@ class ListMutationTestState(BaseState): self.friends_in_dict["Tommy"].clear() # nested list - friends_in_nested_list = [["Tommy"], ["Jenny"]] + friends_in_nested_list: List[List[str]] = [["Tommy"], ["Jenny"]] def remove_first_group(self): """Remove the first group of friends from the nested list."""