This one continues #2872.
Here is a reproducible example:
from typing import TypedDict, List
from hypothesis import given, strategies as st
class SomeData(TypedDict):
a: str
b: int
class SomeMoreData(SomeData):
c: List[int]
st.register_type_strategy(
SomeData, st.builds(SomeData, a=st.just("string from strategy"), b=st.just(42))
)
@given(st.from_type(SomeMoreData))
def test_some_data(item):
assert item["a"] == "string from strategy"
assert item["b"] == 42
class EvenMoreData(SomeMoreData):
b: bool # tricky case - should *not* use SomeData strategy for this
print(SomeData.__annotations__)
print(SomeMoreData.__annotations__)
print(EvenMoreData.__annotations__)
For now, the test will fail, but it make sense to mind inheritance when inferring TypedDicts types.
If the proposition (or bug, whatever) is approved, I'll try to implement the thing.
This one continues #2872.
Here is a reproducible example:
For now, the test will fail, but it make sense to mind inheritance when inferring TypedDicts types.
If the proposition (or bug, whatever) is approved, I'll try to implement the thing.