-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: adjust
copy_with
to attempt to use __class_getitem__
as …
…the fallback
- Loading branch information
1 parent
6f343b2
commit 2117a8d
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from instruct import Base, public_class | ||
|
||
|
||
def test_subtraction(): | ||
class Foo(Base): | ||
a: tuple[int, ...] | ||
b: str | int | ||
c: str | ||
|
||
class FooGroup(Base): | ||
foos: list[Foo] | ||
|
||
cls = FooGroup - {"foos": {"a", "b"}} | ||
|
||
ModifiedFoo = public_class(cls, "foos", preserve_subtraction=True) | ||
|
||
assert tuple(ModifiedFoo) == ("c",) |