@@ -80,20 +80,32 @@ def test_immutability() -> None:
8080 pane_id = "pane123" , width = 80 , height = 24 , captured_content = ["Line1" ]
8181 )
8282
83- # Attempting to modify a field should raise AttributeError with precise error message
84- with pytest .raises (AttributeError , match = r"PaneSnapshot is immutable: cannot modify field 'width'" ):
83+ # Attempting to modify a field should raise AttributeError
84+ # with precise error message
85+ with pytest .raises (
86+ AttributeError , match = r"PaneSnapshot is immutable: cannot modify field 'width'"
87+ ):
8588 snapshot .width = 200 # type: ignore
8689
87- # Attempting to add a new field should raise AttributeError with precise error message
88- with pytest .raises (AttributeError , match = r"PaneSnapshot is immutable: cannot modify field 'new_field'" ):
90+ # Attempting to add a new field should raise AttributeError
91+ # with precise error message
92+ with pytest .raises (
93+ AttributeError ,
94+ match = r"PaneSnapshot is immutable: cannot modify field 'new_field'" ,
95+ ):
8996 snapshot .new_field = "value" # type: ignore
9097
91- # Attempting to delete a field should raise AttributeError with precise error message
92- with pytest .raises (AttributeError , match = r"PaneSnapshot is immutable: cannot delete field 'width'" ):
98+ # Attempting to delete a field should raise AttributeError
99+ # with precise error message
100+ with pytest .raises (
101+ AttributeError , match = r"PaneSnapshot is immutable: cannot delete field 'width'"
102+ ):
93103 del snapshot .width
94104
95105 # Calling a method that tries to modify state should fail
96- with pytest .raises (NotImplementedError , match = r"Snapshot is immutable. resize\(\) not allowed." ):
106+ with pytest .raises (
107+ NotImplementedError , match = r"Snapshot is immutable. resize\(\) not allowed."
108+ ):
97109 snapshot .resize (200 , 50 )
98110
99111
@@ -188,7 +200,7 @@ def test_bidirectional_references() -> None:
188200
189201class DimensionTestCase (t .NamedTuple ):
190202 """Test fixture for validating dimensions in PaneSnapshot.
191-
203+
192204 Note: This implementation intentionally allows any dimension values, including
193205 negative or extremely large values. In a real-world application, you might want
194206 to add validation to the class constructor if certain dimension ranges are required.
@@ -287,7 +299,7 @@ def test_frozen_flag(
287299 error_match : str | None ,
288300) -> None :
289301 """Test behavior when attempting to manipulate the _frozen flag.
290-
302+
291303 Note: We discovered that setting _frozen=False actually allows mutation,
292304 which could be a potential security issue if users know about this behavior.
293305 In a more secure implementation, the _frozen attribute might need additional
0 commit comments