Skip to content

Commit

Permalink
added test for remove and names
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Dec 15, 2024
1 parent 4bd5b67 commit cceac83
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/paramak/assemblies/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,3 @@ def names(self):
for part in self:
names.append(part[1].split('/')[-1])
return names




# testing
# sphere1 = cq.Workplane().moveTo(2, 2).sphere(1)
# box1 = cq.Workplane().box(1, 1, 1)
# assembly = Assembly()
# assembly.add(box1, name="box1", color=cq.Color(0.5, 0.5, 0.5))
# assembly.add(sphere1, name="sphere")


# assembly2 = assembly.remove('sphere')
# assembly3 = assembly.remove('box1')
# assembly4 = assembly.remove('bosdfsdf')
20 changes: 20 additions & 0 deletions tests/test_assemblies/test_assembly.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import cadquery as cq
from paramak.assemblies.assembly import Assembly

def test_remove_and_names():

sphere1 = cq.Workplane().moveTo(2, 2).sphere(1)
box1 = cq.Workplane().box(1, 1, 1)
assembly = Assembly()
assembly.add(box1, name="box1", color=cq.Color(0.5, 0.5, 0.5))
assembly.add(sphere1, name="sphere")


assembly2 = assembly.remove('sphere')
assembly3 = assembly.remove('box1')
assembly4 = assembly.remove('bosdfsdf')

assert assembly.names() == ['box1', 'sphere']
assert assembly2.names() == ['box1']
assert assembly3.names() == ['sphere']
assert assembly4.names() == ['box1', 'sphere']

0 comments on commit cceac83

Please sign in to comment.