Closed lebrice closed 1 year ago
It would be good to add a test case to make sure Partial
works with #223. For example,
@dataclasses.dataclass(frozen=True, kw_only=True)
class A:
x: int
y: bool = True
A1: Type[Partial[A]] = sp.config(A, ignore="x")
@dataclasses.dataclass(frozen=True, kw_only=True)
class B:
a: Partial[A] = sp.subgroups({
'a1': A1(y=False),
})
b = sp.parse(B)
assert b.a(x=1) == A(x=1, y=False)
This PR adds Partials: Dynamically created dataclasses for arbitrary callables.
It's still a work in progress. I'll update this whenever I find the time.