コード例 #1
0
 def test_strings(self):
     """Tests the printing behavior. Task 6."""
     c1 = Circle(2)
     c1_repr=  c1.__repr__()
     c1_str = c1.__str__()
     correct_str = 'A circle with radius 2.00.'
     correct_repr = 'Circle (2.00)'
     self.assertEqual(c1_repr, correct_repr)
     self.assertEqual(c1_str, correct_str)
コード例 #2
0
def test_repr_function():
    a = Circle(5)
    assert a.__repr__() == "Circle(5)"