Cosplay/nhf/test.py

25 lines
530 B
Python
Raw Normal View History

2024-06-20 23:29:18 -07:00
import unittest
2024-06-24 11:13:11 -07:00
import cadquery as Cq
2024-07-04 00:42:14 -07:00
from nhf.build import Model, target
2024-06-20 23:29:18 -07:00
2024-07-04 00:42:14 -07:00
class BuildScaffold(Model):
2024-06-20 23:29:18 -07:00
2024-07-04 00:42:14 -07:00
@target(name="obj1")
def o1(self):
return Cq.Solid.makeBox(10, 10, 10)
2024-06-30 14:28:42 -07:00
2024-07-04 00:42:14 -07:00
def o2(self):
return Cq.Solid.makeCylinder(10, 20)
2024-06-20 23:29:18 -07:00
2024-07-04 00:42:14 -07:00
class TestBuild(unittest.TestCase):
2024-06-25 06:11:48 -07:00
2024-07-04 00:42:14 -07:00
def test_build_scaffold(self):
s = BuildScaffold()
names = ["obj1"]
self.assertEqual(s.target_names, names)
self.assertEqual(s.check_all(), len(names))
2024-06-26 08:28:25 -07:00
2024-06-25 06:11:48 -07:00
2024-06-20 23:29:18 -07:00
if __name__ == '__main__':
unittest.main()