forked from KulEDmitr/geometric_lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_circle.py
More file actions
47 lines (36 loc) · 1.27 KB
/
test_circle.py
File metadata and controls
47 lines (36 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import unittest
from circle import *
class CircleTestCase(unittest.TestCase):
def test_area_zero(self):
res = area(0)
self.assertEqual(res, 0)
def test_area_minus(self):
with self.assertRaises(TypeError):
res = area(-5)
def test_area_random(self):
res = area(178596)
self.assertEqual(res, 100205908143.18312)
def test_area_string(self):
with self.assertRaises(TypeError):
res = area("a")
def test_area_double(self):
res = area(1.45)
self.assertEqual(res, 6.6051985541725395)
def test_area_underscore_number(self):
res = area(178_596)
self.assertEqual(res, 100205908143.18312)
def test_perimeter_random(self):
res = perimeter(178596)
self.assertEqual(res, 1122151.7631210454)
def test_perimeter_minus(self):
with self.assertRaises(TypeError):
res = perimeter(-5)
def test_perimeter_string(self):
with self.assertRaises(TypeError):
res = perimeter("a")
def test_perimeter_double(self):
res = perimeter(1.45)
self.assertEqual(res, 9.1106186954104)
def test_perimeter_underscore_number(self):
res = perimeter(178_596)
self.assertEqual(res, 1122151.7631210454)