Assume I have an existing class like below.
class Animal:
name: str
def __init__(self, name: str) -> None:
self.name = name
def get_name(self) -> str:
return self.name
And in another class, I assign another attribute to this class.
class Type:
"""Another class that is dynamically assigned to one of Animal attributes."""
class TestCase:
animal: Animal
def __init__(self, name: str) -> None:
self.animal = Animal(name)
self.animal.type = Type()
How can I make a type annotation to let TestCase class knowing about animal.type: Type?