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

Method test_newslots

Lib/test/test_descr.py:1823–1839  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1821 self.assertNotHasAttr(a, 'x')
1822
1823 def test_newslots(self):
1824 # Testing __new__ slot override...
1825 class C(list):
1826 def __new__(cls):
1827 self = list.__new__(cls)
1828 self.foo = 1
1829 return self
1830 def __init__(self):
1831 self.foo = self.foo + 2
1832 a = C()
1833 self.assertEqual(a.foo, 3)
1834 self.assertEqual(a.__class__, C)
1835 class D(C):
1836 pass
1837 b = D()
1838 self.assertEqual(b.foo, 3)
1839 self.assertEqual(b.__class__, D)
1840
1841 # TODO: RUSTPYTHON; The `expectedFailure` here is from CPython, so this test must fail
1842 # @unittest.expectedFailure

Callers

nothing calls this directly

Calls 3

CClass · 0.70
DClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected