def test_compare(): c1 = Circle(2) c2 = Circle(4) assert (c1 > c2) == False assert (c1 < c2) == True assert (c1 == c2) == False c3 = Circle(4) assert (c2 == c3) == True
def test_multiply_reflection(): c2 = Circle(4) c3 = 3 * c2 assert c3.radius == 12
def test_multiply(): c2 = Circle(4) c3 = c2 * 3 assert c3.radius == 12
def test_add(): c1 = Circle(2) c2 = Circle(4) c3 = c1 + c2 assert c3.radius == 6
def test_repr(): c = Circle(4) repr(c) == 'Circle(4)'
def test_str(): c = Circle(4) assert str(c) == 'Circle with radius: 4.000000'
def test_create_by_diameter(): c = Circle.circle_d(14) assert c.diameter == 14 assert c.radius == 7 assert c.area == math.pi * 7**2
def test_reflected(): a_circle = Circle(3) assert a_circle * 3 == 3 * a_circle
def test_change_diameter(): c = Circle(5) c.diameter = 12 assert c.diameter == 12 assert c.radius == 6
def test_change_radius(): c = Circle(5) c.radius = 2 assert c.diameter == 4
def test_diameter(): c = Circle(5) assert c.diameter == 10
def test_augmented_assignment_mul(): c1 = Circle(2) c1 *= 2 assert c1.radius == 4
def test_augmented_assignment_add(): c1 = Circle(2) c2 = Circle(4) c1 += c2 assert c1.radius == 6
def test_divide_reflection(): c2 = Circle(4) c3 = 12 / c2 assert c3.radius == 3
def test_divide(): c2 = Circle(6) c3 = c2 / 3 assert c3.radius == 2
def test_area(): c = Circle(4) assert c.area == math.pi * 4**2
def test_sorting(): circles = [ Circle(6), Circle(7), Circle(8), Circle(4), Circle(0), Circle(2), Circle(3), Circle(5), Circle(9), Circle(1) ] circles.sort() assert circles == [ Circle(0), Circle(1), Circle(2), Circle(3), Circle(4), Circle(5), Circle(6), Circle(7), Circle(8), Circle(9) ]
def test_radius(): c = Circle(4) assert c.radius == 4