From 4ccb49298680ec8547d0497103f09b9a3cc5e270 Mon Sep 17 00:00:00 2001 From: Renaud NEDELEC Date: Wed, 14 Oct 2015 12:14:11 +0200 Subject: [PATCH] [PythonAPI] added a first test case for the modeler API --- src/PythonAPI/modeler/tests/CMakeLists.txt | 2 ++ .../modeler/tests/modeler_test_case.py | 18 ++++++++++++++++++ src/PythonAPI/modeler/tests/test_sketcher.py | 14 ++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 src/PythonAPI/modeler/tests/CMakeLists.txt create mode 100644 src/PythonAPI/modeler/tests/modeler_test_case.py create mode 100644 src/PythonAPI/modeler/tests/test_sketcher.py diff --git a/src/PythonAPI/modeler/tests/CMakeLists.txt b/src/PythonAPI/modeler/tests/CMakeLists.txt new file mode 100644 index 000000000..c42456c7c --- /dev/null +++ b/src/PythonAPI/modeler/tests/CMakeLists.txt @@ -0,0 +1,2 @@ +enable_testing() +add_test(NAME "test_modeler" COMMAND "python" "modeler_test_case.py") diff --git a/src/PythonAPI/modeler/tests/modeler_test_case.py b/src/PythonAPI/modeler/tests/modeler_test_case.py new file mode 100644 index 000000000..347aa5afe --- /dev/null +++ b/src/PythonAPI/modeler/tests/modeler_test_case.py @@ -0,0 +1,18 @@ +import unittest +import modeler + +class ModelerTestCase(unittest.TestCase): + def setUp(self): + modeler.begin() + partset = modeler.moduleDocument() + self.part = modeler.addPart(partset).document() + + def tearDown(self): + modeler.end() + + def test_add_sketch(self): + plane = modeler.defaultPlane("XOY") + modeler.addSketch(self.part, plane) + +if __name__ == "__main__": + unittest.main() diff --git a/src/PythonAPI/modeler/tests/test_sketcher.py b/src/PythonAPI/modeler/tests/test_sketcher.py new file mode 100644 index 000000000..b1f641b31 --- /dev/null +++ b/src/PythonAPI/modeler/tests/test_sketcher.py @@ -0,0 +1,14 @@ +import unittest +import modeler + +class TestSketcher(unittest.TestCase): + def test_init_sketch(self): + modeler.begin() + partset = modeler.moduleDocument() + part = modeler.addPart(partset).document() + plane = modeler.defaultPlane("XOY") + modeler.addSketch(part, plane) + modeler.end() + +if __name__ == "__main__": + unittest.main() -- 2.39.2