Beispiel #1
0
 def test_eq(self):
     t = shape.Triangle(4, 5, 6)
     assert t == shape.Triangle(4, 5, 6)
     assert t == shape.Triangle(6, 4, 5)
     assert t == shape.Triangle(5, 6, 4)
Beispiel #2
0
 def test_scale(self):
     assert shape.Triangle(3, 4, 5).scale(10) == shape.Triangle(30, 40, 50)
Beispiel #3
0
 def test_rotations(self):
     t = shape.Triangle(4, 5, 6)
     assert t._rotations() == ((4, 5, 6), (6, 4, 5), (5, 6, 4))
Beispiel #4
0
 def test_area(self):
     assert shape.Triangle(3, 4, 5).area() == 6
     assert shape.Triangle(30, 40, 50).area() == 600
Beispiel #5
0
 def test_perimeter(self):
     assert shape.Triangle(4, 5, 6).perimeter() == 15
     assert shape.Triangle(30, 40, 50).perimeter() == 120
Beispiel #6
0
 def test_is_isosceles(self):
     assert shape.Triangle(4, 5, 6).is_isosceles() is False
     assert shape.Triangle(4, 5, 5).is_isosceles() is True
Beispiel #7
0
 def test_is_equilateral(self):
     assert shape.Triangle(4, 5, 6).is_equilateral() is False
     assert shape.Triangle(4, 4, 4).is_equilateral() is True
Beispiel #8
0
 def test_is_similar(self):
     t = shape.Triangle(4, 5, 6)
     assert t.is_similar(shape.Triangle(4, 5, 6))
     assert t.is_similar(shape.Triangle(10, 12, 8))