@@ -588,9 +588,6 @@ def test_Struct_reinitialization(self):
588588 with self .assertWarns (DeprecationWarning ):
589589 s .__init__ ('<ii' )
590590 self .assertEqual (s .format , '<ii' )
591- packed = b'\x01 \x00 \x00 \x00 \x02 \x00 \x00 \x00 '
592- self .assertEqual (s .pack (1 , 2 ), packed )
593- self .assertEqual (s .unpack (packed ), (1 , 2 ))
594591
595592 def check_sizeof (self , format_str , number_of_codes ):
596593 # The size of 'PyStructObject'
@@ -800,38 +797,38 @@ def __init__(self):
800797
801798 with self .assertWarns (DeprecationWarning ):
802799 my_struct = MyStruct ()
803- self .assertEqual (my_struct .pack ( 12345 ), b' \x30 \x39 ' )
800+ self .assertEqual (my_struct .format , '>h ' )
804801
805802 # New way, no warnings:
806803 class MyStruct (struct .Struct ):
807804 def __new__ (cls ):
808805 return super ().__new__ (cls , '>h' )
809806 my_struct = MyStruct ()
810- self .assertEqual (my_struct .pack ( 12345 ), b' \x30 \x39 ' )
807+ self .assertEqual (my_struct .format , '>h ' )
811808
812809 class MyStruct (struct .Struct ):
813810 def __new__ (cls , arg ):
814811 self = super ().__new__ (cls , '>h' )
815812 return self
816813
817814 my_struct = MyStruct (5 )
818- self .assertEqual (my_struct .pack ( 123 ), b' \x00 { ' )
815+ self .assertEqual (my_struct .format , '>h ' )
819816
820817 class MyStruct (struct .Struct ):
821818 def __init__ (self , * args , ** kwargs ):
822819 super ().__init__ ('>h' )
823820
824821 with self .assertWarns (DeprecationWarning ):
825822 my_struct = MyStruct ('<h' )
826- self .assertEqual (my_struct .pack ( 12345 ), b' \x30 \x39 ' )
823+ self .assertEqual (my_struct .format , '>h ' )
827824
828825 with self .assertWarns (DeprecationWarning ):
829826 my_struct = MyStruct (5 )
830- self .assertEqual (my_struct .pack ( 12345 ), b' \x30 \x39 ' )
827+ self .assertEqual (my_struct .format , '>h ' )
831828
832829 with self .assertWarns (DeprecationWarning ):
833830 my_struct = MyStruct ('>h' )
834- self .assertEqual (my_struct .pack ( 12345 ), b' \x30 \x39 ' )
831+ self .assertEqual (my_struct .format , '>h ' )
835832
836833 def test_repr (self ):
837834 s = struct .Struct ('=i2H' )
0 commit comments