@@ -85,15 +85,15 @@ def test_immutability() -> None:
8585 with pytest .raises (
8686 AttributeError , match = r"PaneSnapshot is immutable: cannot modify field 'width'"
8787 ):
88- snapshot .width = 200 # type: ignore
88+ snapshot .width = 200
8989
9090 # Attempting to add a new field should raise AttributeError
9191 # with precise error message
9292 with pytest .raises (
9393 AttributeError ,
9494 match = r"PaneSnapshot is immutable: cannot modify field 'new_field'" ,
9595 ):
96- snapshot .new_field = "value" # type: ignore
96+ snapshot .new_field = "value" # type: ignore[attr-defined]
9797
9898 # Attempting to delete a field should raise AttributeError
9999 # with precise error message
@@ -141,8 +141,8 @@ def test_internal_attributes() -> None:
141141 )
142142
143143 # Should be able to set internal attributes
144- snapshot ._internal_cache = {"test" : "value" } # type: ignore
145- assert snapshot ._internal_cache == {"test" : "value" } # type: ignore
144+ snapshot ._internal_cache = {"test" : "value" } # type: ignore[attr-defined]
145+ assert snapshot ._internal_cache == {"test" : "value" } # type: ignore[attr-defined]
146146
147147
148148def test_nested_mutability_leak () -> None :
@@ -154,7 +154,7 @@ def test_nested_mutability_leak() -> None:
154154
155155 # Can't reassign the field itself
156156 with pytest .raises (AttributeError , match = "immutable" ):
157- snapshot .captured_content = ["new" ] # type: ignore
157+ snapshot .captured_content = ["new" ]
158158
159159 # But we can modify its contents (limitation of Python immutability)
160160 snapshot .captured_content .append ("mutated" )
@@ -259,7 +259,7 @@ def test_snapshot_dimensions(
259259
260260 # Verify immutability
261261 with pytest .raises (AttributeError , match = "immutable" ):
262- pane .width = 100 # type: ignore
262+ pane .width = 100
263263
264264
265265class FrozenFlagTestCase (t .NamedTuple ):
@@ -311,14 +311,14 @@ def test_frozen_flag(
311311
312312 # Attempt to unfreeze if requested
313313 if unfreeze_attempt :
314- pane ._frozen = False # type: ignore
314+ pane ._frozen = False # type: ignore[attr-defined]
315315
316316 # Attempt mutation and check if it fails as expected
317317 if expect_mutation_error :
318318 with pytest .raises (AttributeError , match = error_match ):
319- pane .width = 200 # type: ignore
319+ pane .width = 200
320320 else :
321- pane .width = 200 # type: ignore
321+ pane .width = 200
322322 assert pane .width == 200
323323
324324
@@ -422,7 +422,7 @@ def test_inheritance_behavior(
422422 if mutate_derived :
423423 if expect_derived_error :
424424 with pytest .raises (AttributeError ):
425- derived .width = 100 # type: ignore
425+ derived .width = 100
426426 else :
427- derived .width = 100 # type: ignore
427+ derived .width = 100
428428 assert derived .width == 100
0 commit comments