3 import dynamic_graph
as dg
4 from custom_entity
import CustomEntity
7 """Python argument types in
8 dynamic_graph.wrap.plug(%s, %s)
9 did not match C++ signature:
11 "dynamicgraph::SignalBase<long>* signalOut, "
12 "dynamicgraph::SignalBase<long>* signalIn)"
19 test the type checking in signal plugs
21 first = CustomEntity(
"first_entity")
22 second = CustomEntity(
"second_entity")
24 dg.plug(first.signal(
"out_double"), second.signal(
"in_double"))
27 with self.assertRaises(TypeError)
as cm_in:
28 dg.plug(first.signal(
"out_double"), second)
30 str(cm_in.exception), ERR % (
"SignalTimeDependentDouble",
"CustomEntity")
34 with self.assertRaises(TypeError)
as cm_out:
35 dg.plug(first, second.signal(
"in_double"))
37 str(cm_out.exception), ERR % (
"CustomEntity",
"SignalPtrDouble")
42 test that exceptions from dynamic graph are correctly raised
44 ent = CustomEntity(
"test_dg_exc")
46 with self.assertRaises(RuntimeError)
as cm:
50 "In SignalPtr: SIN ptr not set. "
51 "(in signal <CustomEntity(test_dg_exc)::input(double)::in_double>)",
55 ent_2 = CustomEntity(
"another_entity")
56 dg.plug(ent_2.signal(
"out_double"), ent.signal(
"in_double"))
60 if __name__ ==
"__main__":