Many tests using things like dictionaries need a very specific set of keys, or set of results.
Interfaces should provide a solution to this, through a mechanism supporting specific generation of objects as input into the function. This should aim to alleviate the burden of creating generators.
The way to do this is to leverage typing's TypedDict.
class Point2D(TypedDict):
x: int
y: int
label: str
a: Point2D = {'x': 1, 'y': 2, 'label': 'good'} # OK
The user should also be able to directly provide a value for their class attribute.
Many tests using things like dictionaries need a very specific set of keys, or set of results.
Interfaces should provide a solution to this, through a mechanism supporting specific generation of objects as input into the function. This should aim to alleviate the burden of creating generators.
The way to do this is to leverage typing's
TypedDict
.The user should also be able to directly provide a value for their class attribute.