@@ -562,62 +562,6 @@ class DeepContainer:
562562 assert id (deep .items ) != id (regular .items )
563563
564564
565- def test_slots_support () -> None :
566- """Test support for dataclasses with __slots__."""
567-
568- @frozen_dataclass_sealable
569- class SimpleContainer :
570- name : str = field (metadata = {"mutable_during_init" : True })
571- values : List [str ] = field (default_factory = list , metadata = {"mutable_during_init" : True })
572-
573- @frozen_dataclass_sealable (slots = True )
574- class SlottedSimpleContainer :
575- name : str = field (metadata = {"mutable_during_init" : True })
576- values : List [str ] = field (default_factory = list , metadata = {"mutable_during_init" : True })
577-
578- normal = SimpleContainer (name = "test" )
579- slotted = SlottedSimpleContainer (name = "test" )
580-
581- # Normal class should have __dict__, slotted shouldn't
582- assert hasattr (normal , "__dict__" )
583- with pytest .raises (AttributeError ):
584- slotted .__dict__
585-
586- # Both classes should be sealable
587- assert is_sealable (normal )
588- assert is_sealable (slotted )
589-
590- # Both should be modifiable before sealing
591- normal .name = "modified"
592- slotted .name = "modified"
593-
594- print (f"Before sealing - normal._sealed: { getattr (normal , '_sealed' , 'N/A' )} " )
595-
596- # For slotted class, check if _sealed attribute exists
597- try :
598- print (f"Before sealing - slotted._sealed: { getattr (slotted , '_sealed' , 'N/A' )} " )
599- except AttributeError :
600- print ("Before sealing - slotted._sealed attribute doesn't exist" )
601-
602- # Seal both instances
603- normal .seal ()
604- slotted .seal ()
605-
606- print (f"After sealing - normal._sealed: { getattr (normal , '_sealed' , 'N/A' )} " )
607-
608- # For slotted class, check if _sealed attribute exists
609- try :
610- print (f"After sealing - slotted._sealed: { getattr (slotted , '_sealed' , 'N/A' )} " )
611- except AttributeError :
612- print ("After sealing - slotted._sealed attribute doesn't exist" )
613-
614- # After sealing, modifications should raise AttributeError
615- with pytest .raises (AttributeError ):
616- normal .name = "modified again"
617- with pytest .raises (AttributeError ):
618- slotted .name = "modified again"
619-
620-
621565def test_is_sealable () -> None :
622566 """Test the is_sealable class method."""
623567
0 commit comments