def test_setting(self): """Test setting elements.""" po = ProjectObject.gen_meshes_object(id="-1", meshes=self.meshes) po.pose = self.pose po.category = "table" po.symmetry = ObjectSymmetry.example() po.score = 0.23 self.assertTrue(isinstance(po.pose, Pose3)) self.assertAlmostEqual(po.pose, self.pose) self.assertTrue(isinstance(po.meshes, GltfModel)) self.assertTrue(isinstance(po.category, "".__class__)) self.assertTrue(isinstance(po.symmetry, ObjectSymmetry)) self.assertEqual(po.category, "table") self.assertEqual(po.id, "-1") self.assertEqual(po.symmetry, ObjectSymmetry.example()) self.assertAlmostEqual(po.score, 0.23)
def example(cls, id="1"): """Create a simple ProjectObject of project_type = meshes.""" meshes = GltfModel.example() pose = Pose3(t=Vector3(1, 2, 3)) symmetry = ObjectSymmetry.example() return cls.gen_meshes_object(id=id, pose=pose, category="chair", meshes=meshes, symmetry=symmetry, score=0.57)