def test_cast_to_wrong_object_raises(self): sphere = iDynTree.Sphere() sphere.radius = 3.14 mesh = iDynTree.ExternalMesh() mesh.filename = "a_filename" with self.assertRaises(ValueError): sphere.as_external_mesh() with self.assertRaises(ValueError): mesh.as_sphere()
def test_cast_to_correct_object_is_ok(self): sphere = iDynTree.Sphere() sphere.radius = 3.14 mesh = iDynTree.ExternalMesh() mesh.filename = "a_filename" to_sphere = sphere.as_sphere() self.assertIsNotNone(to_sphere) self.assertEqual(to_sphere.radius, 3.14) to_mesh = mesh.as_external_mesh() self.assertIsNotNone(to_mesh) self.assertEqual(to_mesh.filename, "a_filename")
def test_sphere_radius(self): sphere = iDynTree.Sphere() sphere.radius = 3.14 self.assertEqual(sphere.radius, 3.14)