import unittest import cadquery as Cq import nhf.touhou.houjuu_nue as M import nhf.touhou.houjuu_nue.joints as MJ from nhf.checks import pairwise_intersection class TestJoints(unittest.TestCase): def test_shoulder_collision_0(self): j = MJ.ShoulderJoint() assembly = j.assembly() self.assertEqual(pairwise_intersection(assembly), []) def test_disk_collision_0(self): j = MJ.DiskJoint() assembly = j.assembly(angle=0) self.assertEqual(pairwise_intersection(assembly), []) def test_disk_collision_mid(self): j = MJ.DiskJoint() assembly = j.assembly(angle=j.movement_angle / 2) self.assertEqual(pairwise_intersection(assembly), []) def test_disk_collision_max(self): j = MJ.DiskJoint() assembly = j.assembly(angle=j.movement_angle) self.assertEqual(pairwise_intersection(assembly), []) class Test(unittest.TestCase): def test_hs_joint_parent(self): p = M.Parameters() obj = p.harness.hs_joint_parent() self.assertIsInstance(obj.val().solids(), Cq.Solid, msg="H-S joint must be in one piece") def test_wings_assembly(self): p = M.Parameters() p.wings_harness_assembly() def test_trident_assembly(self): p = M.Parameters() assembly = p.trident.assembly() bbox = assembly.toCompound().BoundingBox() length = bbox.zlen self.assertGreater(length, 1300) self.assertLess(length, 1700) #def test_assemblies(self): # p = M.Parameters() # p.check_all() if __name__ == '__main__': unittest.main()