FEM: unit tests, add some comment

This commit is contained in:
Bernd Hahnebach
2018-05-21 14:32:19 +02:00
committed by wmayer
parent 81ae098b18
commit bbd340bc1a
2 changed files with 10 additions and 3 deletions

View File

@@ -42,25 +42,30 @@ https://forum.freecadweb.org/viewtopic.php?f=10&t=22190#p175546
examples from within FreeCAD:
# module
import Test, TestFem
Test.runTestsFromModule(TestFem)
import Test, femtest.testcommon
Test.runTestsFromModule(femtest.testcommon)
# class
import Test, TestFem
Test.runTestsFromClass(TestFem.FemTest)
import Test, femtest.testcommon
Test.runTestsFromClass(femtest.testcommon.FemTest)
# method
import unittest
mytest = unittest.TestLoader().loadTestsFromName("TestFem.FemTest.test_pyimport_all_FEM_modules")
unittest.TextTestRunner().run(mytest)
import unittest
mytest = unittest.TestLoader().loadTestsFromName("TestFem.FemTest.test_femobjects_make")
unittest.TextTestRunner().run(mytest)
# it may be useful to temporary comment FreeCAD.closeDocument("FemTest") in tearDown method to not close the document
examples from shell in build dir:

View File

@@ -273,7 +273,9 @@ class FemTest(unittest.TestCase):
analysis.addObject(ObjectsFem.makeEquationFlow(doc, sol))
analysis.addObject(ObjectsFem.makeEquationFluxsolver(doc, sol))
analysis.addObject(ObjectsFem.makeEquationHeat(doc, sol))
# TODO the equations show up twice on Tree (on solver and on analysis), if they are added to the analysis group
# TODO if the equations and gmsh mesh childs are added to the analysis,
# they show up twice on Tree (on solver resp. gemsh mesh obj and on analysis)
# https://forum.freecadweb.org/viewtopic.php?t=25283
doc.recompute()
self.assertEqual(len(analysis.Group), testtools.get_defmake_count() - 1) # because of the analysis itself count -1