Skip to content
Snippets Groups Projects
Commit 6e43bd1f authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[Tests] checks that connecting a signal to an entity raises an exception

For now, this test doesn't pass, as an exception is not properly fired,
but we get a segfault instead.
parent 4db30576
No related branches found
No related tags found
No related merge requests found
# 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)
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()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment