From ecafc3da6c8d421882843ef2f46b41a9f76cd2fb Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Tue, 17 Mar 2020 21:21:05 +0100 Subject: [PATCH] FEM: unit test, code improvements --- src/Mod/Fem/femtest/app/support_utils.py | 7 ++++--- src/Mod/Fem/femtest/app/test_ccxtools.py | 10 +++++++--- src/Mod/Fem/femtest/app/test_common.py | 9 +++++++-- src/Mod/Fem/femtest/app/test_femimport.py | 6 +++++- src/Mod/Fem/femtest/app/test_material.py | 12 ++++++++---- src/Mod/Fem/femtest/app/test_mesh.py | 13 +++++++++---- src/Mod/Fem/femtest/app/test_object.py | 9 +++++++-- src/Mod/Fem/femtest/app/test_result.py | 12 ++++++++---- src/Mod/Fem/femtest/app/test_solverframework.py | 15 ++++++++++----- 9 files changed, 65 insertions(+), 28 deletions(-) diff --git a/src/Mod/Fem/femtest/app/support_utils.py b/src/Mod/Fem/femtest/app/support_utils.py index 534f1adb47..0709868208 100644 --- a/src/Mod/Fem/femtest/app/support_utils.py +++ b/src/Mod/Fem/femtest/app/support_utils.py @@ -19,17 +19,18 @@ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * -# ***************************************************************************/ +# *************************************************************************** __title__ = "Tools for FEM unit tests" __author__ = "Bernd Hahnebach" __url__ = "http://www.freecadweb.org" - import os -import unittest import tempfile +import unittest + import FreeCAD + from os.path import join diff --git a/src/Mod/Fem/femtest/app/test_ccxtools.py b/src/Mod/Fem/femtest/app/test_ccxtools.py index 3e09c8fc82..381114eb1a 100644 --- a/src/Mod/Fem/femtest/app/test_ccxtools.py +++ b/src/Mod/Fem/femtest/app/test_ccxtools.py @@ -20,16 +20,20 @@ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * -# ***************************************************************************/ +# *************************************************************************** + +__title__ = "Ccxtools FEM unit tests" +__author__ = "Bernd Hahnebach" +__url__ = "http://www.freecadweb.org" import unittest from os.path import join - import FreeCAD -from femtools import ccxtools + from . import support_utils as testtools from .support_utils import fcc_print +from femtools import ccxtools class TestCcxTools(unittest.TestCase): diff --git a/src/Mod/Fem/femtest/app/test_common.py b/src/Mod/Fem/femtest/app/test_common.py index 765b4a6690..4566a3daea 100644 --- a/src/Mod/Fem/femtest/app/test_common.py +++ b/src/Mod/Fem/femtest/app/test_common.py @@ -19,12 +19,17 @@ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * -# ***************************************************************************/ +# *************************************************************************** +__title__ = "Common FEM unit tests" +__author__ = "Bernd Hahnebach" +__url__ = "http://www.freecadweb.org" + +import unittest import FreeCAD + import ObjectsFem -import unittest from . import support_utils as testtools from .support_utils import fcc_print diff --git a/src/Mod/Fem/femtest/app/test_femimport.py b/src/Mod/Fem/femtest/app/test_femimport.py index abb16ce5cf..7d1043c498 100644 --- a/src/Mod/Fem/femtest/app/test_femimport.py +++ b/src/Mod/Fem/femtest/app/test_femimport.py @@ -19,12 +19,16 @@ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * -# ***************************************************************************/ +# *************************************************************************** +__title__ = "Import FEM unit tests" +__author__ = "Bernd Hahnebach" +__url__ = "http://www.freecadweb.org" import unittest import FreeCAD + from .support_utils import fcc_print diff --git a/src/Mod/Fem/femtest/app/test_material.py b/src/Mod/Fem/femtest/app/test_material.py index 30dbae7961..10f3218237 100644 --- a/src/Mod/Fem/femtest/app/test_material.py +++ b/src/Mod/Fem/femtest/app/test_material.py @@ -19,14 +19,18 @@ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * -# ***************************************************************************/ +# *************************************************************************** +__title__ = "Material FEM unit tests" +__author__ = "Bernd Hahnebach" +__url__ = "http://www.freecadweb.org" + +import unittest +from os.path import join import FreeCAD -import unittest -from .support_utils import fcc_print -from os.path import join +from .support_utils import fcc_print class TestMaterialUnits(unittest.TestCase): diff --git a/src/Mod/Fem/femtest/app/test_mesh.py b/src/Mod/Fem/femtest/app/test_mesh.py index cbf8d1bdeb..dc7b005909 100644 --- a/src/Mod/Fem/femtest/app/test_mesh.py +++ b/src/Mod/Fem/femtest/app/test_mesh.py @@ -19,16 +19,21 @@ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * -# ***************************************************************************/ +# *************************************************************************** +__title__ = "Mesh FEM unit tests" +__author__ = "Bernd Hahnebach" +__url__ = "http://www.freecadweb.org" + +import unittest +from os.path import join + +import FreeCAD import Fem -import FreeCAD -import unittest from . import support_utils as testtools from .support_utils import fcc_print -from os.path import join class TestMeshCommon(unittest.TestCase): diff --git a/src/Mod/Fem/femtest/app/test_object.py b/src/Mod/Fem/femtest/app/test_object.py index 37e02b8bdd..5b61eea96b 100644 --- a/src/Mod/Fem/femtest/app/test_object.py +++ b/src/Mod/Fem/femtest/app/test_object.py @@ -19,13 +19,18 @@ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * -# ***************************************************************************/ +# *************************************************************************** + +__title__ = "Objects FEM unit tests" +__author__ = "Bernd Hahnebach" +__url__ = "http://www.freecadweb.org" import sys +import unittest import FreeCAD + import ObjectsFem -import unittest from . import support_utils as testtools from .support_utils import fcc_print diff --git a/src/Mod/Fem/femtest/app/test_result.py b/src/Mod/Fem/femtest/app/test_result.py index 629ef477bc..0096a280a1 100644 --- a/src/Mod/Fem/femtest/app/test_result.py +++ b/src/Mod/Fem/femtest/app/test_result.py @@ -19,16 +19,20 @@ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * -# ***************************************************************************/ +# *************************************************************************** +__title__ = "Results FEM unit tests" +__author__ = "Bernd Hahnebach" +__url__ = "http://www.freecadweb.org" + +import unittest +from os.path import join import FreeCAD -import unittest + from . import support_utils as testtools from .support_utils import fcc_print -from os.path import join - class TestResult(unittest.TestCase): fcc_print("import TestResult") diff --git a/src/Mod/Fem/femtest/app/test_solverframework.py b/src/Mod/Fem/femtest/app/test_solverframework.py index fb64351624..9640f5c846 100644 --- a/src/Mod/Fem/femtest/app/test_solverframework.py +++ b/src/Mod/Fem/femtest/app/test_solverframework.py @@ -19,17 +19,22 @@ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * -# ***************************************************************************/ +# *************************************************************************** + +__title__ = "Sover frame work FEM unit tests" +__author__ = "Bernd Hahnebach" +__url__ = "http://www.freecadweb.org" + +import unittest +from os.path import join import FreeCAD -import ObjectsFem + import femsolver.run -import unittest +import ObjectsFem from . import support_utils as testtools from .support_utils import fcc_print -from os.path import join - class TestSolverFrameWork(unittest.TestCase): fcc_print("import TestSolverFrameWork")