def test_radius_changes_logged(self): circle = Circle(2) self.assertEqual(circle.radius_changes, [2]) circle.radius = 3 self.assertEqual(circle.radius_changes, [2, 3]) circle.diameter = 3 self.assertEqual(circle.radius_changes, [2, 3, 1.5])
def test_change_diameter(): c = Circle(4) assert c.diameter == 8 c.diameter = 8 assert c.radius == 4 assert c.diameter == 8
def test_set_diameter(self): circle = Circle(2) self.assertEqual(circle.diameter, 4) circle.diameter = 3 self.assertEqual(circle.radius, 1.5)