type modernization

This commit is contained in:
John Lancaster
2026-10-10 10:20:22 -05:00
parent 08f2140e2f
commit 308c06c31d
9 changed files with 1461 additions and 445 deletions
+18
View File
@@ -39,6 +39,10 @@ class TestDAGSetInit:
s = DAGSetView(None)
assert len(s) == 0
def test_from_scalar(self) -> None:
s = DAGSetView[int](2)
assert set(s) == {2}
class TestDAGSetBasicOps:
"""Test basic set operations."""
@@ -169,6 +173,20 @@ class TestDAGSetCallbacks:
class TestDAGSetInPlaceOperators:
"""Test in-place set operators."""
def test_scalar_operators_preserve_instance(self) -> None:
class IntSetView(DAGSetView[int]):
pass
view = IntSetView({1, 2})
original = view
view += 3
view |= 4
view -= 1
view &= 2
view ^= 5
assert view is original
assert set(view) == {2, 5}
class TestIOR:
def test_set(self) -> None:
s = DAGSetView({"foo", 2})