diff --git a/unitTesting/CMakeLists.txt b/unitTesting/CMakeLists.txt index 9b793685030aff9af7398830741a47d84f120036..a8a5190ce4b91866e56cdcc8749eba1cbd87d346 100644 --- a/unitTesting/CMakeLists.txt +++ b/unitTesting/CMakeLists.txt @@ -1,5 +1,3 @@ -# Test bindings -ADD_PYTHON_UNIT_TEST("test-bindings" "unitTesting/test_bindings.py" src) # Test the interpreter SET(EXECUTABLE_NAME interpreter-test) @@ -59,3 +57,6 @@ TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${PUBLIC_KEYWORD} ${LIBRARY_NAME} ${PYTHO ## Test it ADD_PYTHON_UNIT_TEST("test-custom-entity" "unitTesting/test_custom_entity.py" src unitTesting) + +# also test other bindings, using this custom entity +ADD_PYTHON_UNIT_TEST("test-bindings" "unitTesting/test_bindings.py" src unitTesting) diff --git a/unitTesting/test_bindings.py b/unitTesting/test_bindings.py index ffb83c0348a34be952c875d24321e17b5e6b4acb..2502cf04cdfd73875149f2f1b2cfa1461f409609 100644 --- a/unitTesting/test_bindings.py +++ b/unitTesting/test_bindings.py @@ -1,14 +1,24 @@ import unittest -import dynamic_graph +import dynamic_graph as dg +from custom_entity import CustomEntity class BindingsTests(unittest.TestCase): def test_bindings(self): with self.assertRaises(Exception) as error: - dynamic_graph.error_out() + dg.error_out() self.assertEqual(str(error), "something bad happend") + def test_type_check(self): + first = CustomEntity('first_entity') + second = CustomEntity('second_entity') + # Check that we can connect first.out to second.in + dg.plug(first.signal('out_double'), second.signal('in_double')) + # Check that we can't connect first.out to second + with self.assertRaises(Exception): + dg.plug(first.signal('out_double'), second) + if __name__ == '__main__': unittest.main()