(self)
| 1987 | |
| 1988 | @unittest.expectedFailure |
| 1989 | def test_restored_object_new(self): |
| 1990 | class A(object): |
| 1991 | def __new__(cls, *args, **kwargs): |
| 1992 | raise AssertionError |
| 1993 | self.assertRaises(AssertionError, A) |
| 1994 | class B(A): |
| 1995 | __new__ = object.__new__ |
| 1996 | def __init__(self, foo): |
| 1997 | self.foo = foo |
| 1998 | with warnings.catch_warnings(): |
| 1999 | warnings.simplefilter('error', DeprecationWarning) |
| 2000 | b = B(3) |
| 2001 | self.assertEqual(b.foo, 3) |
| 2002 | self.assertEqual(b.__class__, B) |
| 2003 | del B.__new__ |
| 2004 | self.assertRaises(AssertionError, B) |
| 2005 | del A.__new__ |
| 2006 | with warnings.catch_warnings(): |
| 2007 | warnings.simplefilter('error', DeprecationWarning) |
| 2008 | b = B(3) |
| 2009 | self.assertEqual(b.foo, 3) |
| 2010 | self.assertEqual(b.__class__, B) |
| 2011 | |
| 2012 | def test_altmro(self): |
| 2013 | # Testing mro() and overriding it... |
nothing calls this directly
no test coverage detected