| 574 | self.fail("Failed to raise RecursionError") |
| 575 | |
| 576 | def testForExceptionsRaisedInInstanceGetattr2(self): |
| 577 | # Tests for exceptions raised in instance_getattr2(). |
| 578 | |
| 579 | def booh(self): |
| 580 | raise AttributeError("booh") |
| 581 | |
| 582 | class A: |
| 583 | a = property(booh) |
| 584 | try: |
| 585 | A().a # Raised AttributeError: A instance has no attribute 'a' |
| 586 | except AttributeError as x: |
| 587 | if str(x) != "booh": |
| 588 | self.fail("attribute error for A().a got masked: %s" % x) |
| 589 | |
| 590 | class E: |
| 591 | __eq__ = property(booh) |
| 592 | E() == E() # In debug mode, caused a C-level assert() to fail |
| 593 | |
| 594 | class I: |
| 595 | __init__ = property(booh) |
| 596 | try: |
| 597 | # In debug mode, printed XXX undetected error and |
| 598 | # raises AttributeError |
| 599 | I() |
| 600 | except AttributeError: |
| 601 | pass |
| 602 | else: |
| 603 | self.fail("attribute error for I.__init__ got masked") |
| 604 | |
| 605 | def assertNotOrderable(self, a, b): |
| 606 | with self.assertRaises(TypeError): |