3 bind_optional = importlib.import_module(
"bind_optional_boost")
7 x = bind_optional.none_if_zero(0)
8 y = bind_optional.none_if_zero(-1)
16 struct = bind_optional.mystruct()
17 assert struct.a
is None 18 assert struct.b
is None 19 assert struct.msg ==
"i am struct" 22 struct = bind_optional.mystruct(2)
24 assert struct.b
is None 26 struct = bind_optional.mystruct(13, -1.0)
28 assert struct.b == -1.0
32 struct = bind_optional.mystruct()
37 assert struct.b == -3.14
43 assert struct.a
is None 44 assert struct.b
is None 45 assert struct.msg
is None 49 struct = bind_optional.create_if_true(
False,
None)
51 struct = bind_optional.create_if_true(
True,
None)
53 assert struct.b
is None 57 M = bind_optional.random_mat_if_true(
False)
59 M = bind_optional.random_mat_if_true(
True)
60 assert M.shape == (4, 4)
def test_struct_setters()