Skip to content

Commit

Permalink
Added tests for wedge centering
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus7070 committed Feb 1, 2021
1 parent d42a1e6 commit be851aa
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_cadquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from random import choice
from random import random
from random import randrange
from itertools import product

from pytest import approx, raises

Expand Down Expand Up @@ -2069,6 +2070,22 @@ def testWedgeCentering(self):
self.assertEqual(1, s.solids().size())
self.assertEqual(5, s.faces().size())
self.assertEqual(5, s.vertices().size())
# check that the bottom corner is where we expect it for all possible combinations of centered
x, y, z = 10, 11, 12
b = [True, False]
expected_x = [-x / 2, 0]
expected_y = [-y / 2, 0]
expected_z = [-z / 2, 0]
for (xopt, xval), (yopt, yval), (zopt, zval) in product(
zip(b, expected_x), zip(b, expected_y), zip(b, expected_z)
):
s = (
Workplane()
.wedge(x, y, z, 2, 2, x - 2, z - 2, centered=(xopt, yopt, zopt))
.vertices("<X and <Y and <Z")
)
self.assertEqual(s.size(), 1)
self.assertTupleAlmostEquals(s.val().toTuple(), (xval, yval, zval), 3)

def testWedgePointList(self):
s = (
Expand Down

0 comments on commit be851aa

Please sign in to comment.