Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasJ committed Nov 2, 2023
1 parent 06492d3 commit a76e61f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/build123d/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -3650,6 +3650,10 @@ def __or__(self, filter_by: Union[Axis, GeomType] = Axis.Z):
"""Filter by axis or geomtype operator |"""
return self.filter_by(filter_by)

def __eq__(self, other: ShapeList):
"""ShapeLists equality operator =="""
return set(self) == set(other)

def __add__(self, other: ShapeList):
"""Combine two ShapeLists together operator +"""
return ShapeList(list(self) + list(other))
Expand Down
8 changes: 8 additions & 0 deletions tests/test_build_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,14 @@ def test_shapes(self):
Box(1, 1, 1)
self.assertIsNone(test._shapes(Compound))

def test_operators(self):
with BuildPart() as test:
Box(1, 1, 1)
self.assertEqual(
(test.faces() | Axis.Z).edges() & (test.faces() | Axis.Y).edges(),
(test.edges() | Axis.X)
)


class TestValidateInputs(unittest.TestCase):
def test_wrong_builder(self):
Expand Down

0 comments on commit a76e61f

Please sign in to comment.