15 from pyuavcan_v0
import load_dsdl
20 Unittests of the load_dsdl method.
25 Test calling load_dsdl again (after it is called by the uavcan module)
27 ns0_dir =
'{}/fake_dsdl/ns0_base/ns0'.
format(os.path.dirname(__file__))
30 test_type = pyuavcan_v0.thirdparty.ns0.Type0()
31 self.assertEqual(test_type.field0, 0)
35 Test calling load_dsdl with paths that contain two different types
38 ns0_dir =
'{}/fake_dsdl/ns0_base/ns0'.
format(os.path.dirname(__file__))
39 ns0_dir_with_redefinition =
'{}/fake_dsdl/ns0_redefined/ns0'.
format(os.path.dirname(__file__))
41 load_dsdl(ns0_dir, ns0_dir_with_redefinition, exclude_dist=
True)
42 except DsdlException
as e:
43 self.assertTrue(e.args[0].startswith(
"Redefinition of data type ID"))
47 Test calling load_dsdl with paths that contain the same type.
49 ns0_dir =
'{}/fake_dsdl/ns0_base/ns0'.
format(os.path.dirname(__file__))
50 ns0_dir_with_redefinition =
'{}/fake_dsdl/ns0_duplicated/ns0'.
format(os.path.dirname(__file__))
51 load_dsdl(ns0_dir, ns0_dir_with_redefinition, exclude_dist=
True)