(self)
| 519 | self.assertRaisesRegex(ValueError, msg, F, '1.1e' + '0' * (maxdigits+1)) |
| 520 | |
| 521 | def testImmutable(self): |
| 522 | r = F(7, 3) |
| 523 | r.__init__(2, 15) |
| 524 | self.assertEqual((7, 3), _components(r)) |
| 525 | |
| 526 | self.assertRaises(AttributeError, setattr, r, 'numerator', 12) |
| 527 | self.assertRaises(AttributeError, setattr, r, 'denominator', 6) |
| 528 | self.assertEqual((7, 3), _components(r)) |
| 529 | |
| 530 | # But if you _really_ need to: |
| 531 | r._numerator = 4 |
| 532 | r._denominator = 2 |
| 533 | self.assertEqual((4, 2), _components(r)) |
| 534 | # Which breaks some important operations: |
| 535 | self.assertNotEqual(F(4, 2), r) |
| 536 | |
| 537 | def testFromFloat(self): |
| 538 | self.assertRaises(TypeError, F.from_float, 3+4j) |
nothing calls this directly
no test coverage detected