Update test_build_sketch.py -> Trapezoid tests

add coverage for Trapezoid changes
This commit is contained in:
jdegenstein 2023-12-11 11:24:40 -06:00 committed by GitHub
parent 767bf03578
commit c75e8d3123
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -382,6 +382,18 @@ class TestBuildSketchObjects(unittest.TestCase):
with BuildSketch() as test: with BuildSketch() as test:
Trapezoid(6, 2, 30) Trapezoid(6, 2, 30)
with self.assertRaises(ValueError):
with BuildSketch() as test:
Trapezoid(6, 2, 150)
with BuildSketch() as test:
t = Trapezoid(12,8,135,90)
self.assertEqual(t.width, 12)
self.assertEqual(t.trapezoid_height, 8)
self.assertEqual(t.left_side_angle, 135)
self.assertEqual(t.right_side_angle, 90)
self.assertAlmostEqual(test.sketch.area, 8 * (12 + 4) / 2, 5)
def test_triangle(self): def test_triangle(self):
tri = Triangle(a=3, b=4, c=5) tri = Triangle(a=3, b=4, c=5)
self.assertAlmostEqual(tri.area, (3 * 4) / 2, 5) self.assertAlmostEqual(tri.area, (3 * 4) / 2, 5)