def testImmutable(self):
    r = F(7, 3)
    r.__init__(2, 15)
    self.assertEqual((7, 3), _components(r))
    self.assertRaises(AttributeError, setattr, r, 'numerator', 12)
    self.assertRaises(AttributeError, setattr, r, 'denominator', 6)
    self.assertEqual((7, 3), _components(r))
    r._numerator = 4
    r._denominator = 2
    self.assertEqual((4, 2), _components(r))
    self.assertNotEqual(F(4, 2), r)
def testImmutable(self):
    r = F(7, 3)
    r.__init__(2, 15)
    self.assertEqual((7, 3), _components(r))
    self.assertRaises(AttributeError, setattr, r, 'numerator', 12)
    self.assertRaises(AttributeError, setattr, r, 'denominator', 6)
    self.assertEqual((7, 3), _components(r))
    r._numerator = 4
    r._denominator = 2
    self.assertEqual((4, 2), _components(r))
    self.assertNotEqual(F(4, 2), r)