MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_copy_inst_getnewargs_ex

Method test_copy_inst_getnewargs_ex

Lib/test/test_copy.py:210–225  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

208 self.assertEqual(y.foo, x.foo)
209
210 def test_copy_inst_getnewargs_ex(self):
211 class C(int):
212 def __new__(cls, *, foo):
213 self = int.__new__(cls)
214 self.foo = foo
215 return self
216 def __getnewargs_ex__(self):
217 return (), {'foo': self.foo}
218 def __eq__(self, other):
219 return self.foo == other.foo
220 x = C(foo=42)
221 y = copy.copy(x)
222 self.assertIsInstance(y, C)
223 self.assertEqual(y, x)
224 self.assertIsNot(y, x)
225 self.assertEqual(y.foo, x.foo)
226
227 def test_copy_inst_getstate(self):
228 class C:

Callers

nothing calls this directly

Calls 5

assertIsInstanceMethod · 0.80
assertIsNotMethod · 0.80
CClass · 0.70
copyMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected