@@ -95,24 +95,67 @@ def f():
9595 pass
9696 class WithMetaclass (metaclass = abc .ABCMeta ):
9797 pass
98- tests = [None , 42 , 2 ** 100 , 3.14 , True , False , 1j ,
98+ tests = [None , ..., NotImplemented ,
99+ 42 , 2 ** 100 , 3.14 , True , False , 1j ,
99100 "hello" , "hello\u1234 " , f .__code__ ,
100- b"world" , bytes (range (256 )),
101- NewStyle , range ( 10 ), Classic , max , WithMetaclass ]
101+ b"world" , bytes (range (256 )), range ( 10 ),
102+ NewStyle , Classic , max , WithMetaclass ]
102103 for x in tests :
103104 self .assertIs (copy .copy (x ), x )
104105
105106 def test_copy_list (self ):
106107 x = [1 , 2 , 3 ]
107- self .assertEqual (copy .copy (x ), x )
108+ y = copy .copy (x )
109+ self .assertEqual (y , x )
110+ self .assertIsNot (y , x )
111+ x = []
112+ y = copy .copy (x )
113+ self .assertEqual (y , x )
114+ self .assertIsNot (y , x )
108115
109116 def test_copy_tuple (self ):
110117 x = (1 , 2 , 3 )
111- self .assertEqual (copy .copy (x ), x )
118+ self .assertIs (copy .copy (x ), x )
119+ x = ()
120+ self .assertIs (copy .copy (x ), x )
121+ x = (1 , 2 , 3 , [])
122+ self .assertIs (copy .copy (x ), x )
112123
113124 def test_copy_dict (self ):
114125 x = {"foo" : 1 , "bar" : 2 }
115- self .assertEqual (copy .copy (x ), x )
126+ y = copy .copy (x )
127+ self .assertEqual (y , x )
128+ self .assertIsNot (y , x )
129+ x = {}
130+ y = copy .copy (x )
131+ self .assertEqual (y , x )
132+ self .assertIsNot (y , x )
133+
134+ def test_copy_set (self ):
135+ x = {1 , 2 , 3 }
136+ y = copy .copy (x )
137+ self .assertEqual (y , x )
138+ self .assertIsNot (y , x )
139+ x = set ()
140+ y = copy .copy (x )
141+ self .assertEqual (y , x )
142+ self .assertIsNot (y , x )
143+
144+ def test_copy_frozenset (self ):
145+ x = frozenset ({1 , 2 , 3 })
146+ self .assertIs (copy .copy (x ), x )
147+ x = frozenset ()
148+ self .assertIs (copy .copy (x ), x )
149+
150+ def test_copy_bytearray (self ):
151+ x = bytearray (b'abc' )
152+ y = copy .copy (x )
153+ self .assertEqual (y , x )
154+ self .assertIsNot (y , x )
155+ x = bytearray ()
156+ y = copy .copy (x )
157+ self .assertEqual (y , x )
158+ self .assertIsNot (y , x )
116159
117160 def test_copy_inst_vanilla (self ):
118161 class C :
0 commit comments