From e8ff5b66b6437e3fec45499f7949d29ecdb81c76 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Wed, 10 Apr 2019 22:33:33 +0200 Subject: [PATCH] Minor tests update to check git repos update --- test/test1001/Versions.py | 171 ++++++++++-------- test/test1002/Performances.py | 141 +++++++++------ test/test6701/Doc_TUI_Exemple_01.py | 62 ++++--- test/test6702/Doc_TUI_Exemple_02.py | 122 +++++++------ test/test6703/Doc_TUI_Exemple_03.py | 141 ++++++++------- .../Doc_TUI_Exemple_03_en_multifonction.py | 143 ++++++++------- test/test6711/Doc_TUI_Exemple_01_Savings.py | 141 ++++++++------- ...erification_des_Assimilation_Algorithms.py | 5 +- .../Verification_des_Checking_Algorithms.py | 5 +- ...ification_des_mono_et_multi_fonctions_A.py | 5 +- ...ification_des_mono_et_multi_fonctions_B.py | 5 +- ...ification_des_mono_et_multi_fonctions_C.py | 5 +- ...ification_des_mono_et_multi_fonctions_D.py | 5 +- ...ification_des_mono_et_multi_fonctions_E.py | 5 +- ...ification_des_mono_et_multi_fonctions_F.py | 5 +- .../Definition_complete_de_cas_3DVAR.py | 5 +- .../Definition_complete_de_cas_Blue.py | 5 +- .../Definition_complete_de_cas_NLLS.py | 5 +- 18 files changed, 541 insertions(+), 435 deletions(-) diff --git a/test/test1001/Versions.py b/test/test1001/Versions.py index 29f307f..964c027 100644 --- a/test/test1001/Versions.py +++ b/test/test1001/Versions.py @@ -19,7 +19,10 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D -"Test des versions de modules" +"Test du système et des versions de modules" + +import sys +import unittest # ============================================================================== # @@ -29,6 +32,94 @@ minimal_python_version = "2.7.9" minimal_numpy_version = "1.8.2" minimal_scipy_version = "0.14.0" minimal_matplotlib_version = "1.4.2" +minimal_nlopt_version = "2.4.2" +# +# ============================================================================== +class Test_Adao(unittest.TestCase): + def test1_minimalVersion(self): + "Affichage des versions minimales" + print(" Les versions minimales attendues sont :") + print(" - Python systeme....: %s"%minimal_python_version) + print(" - Numpy.............: %s"%minimal_numpy_version) + print(" - Scipy.............: %s"%minimal_scipy_version) + print(" - NLopt.............: %s"%minimal_nlopt_version) + print(" - Matplotlib........: %s"%minimal_matplotlib_version) + print("") + + def test2_Version(self): + "Test du système et des versions de modules" + print(" Les versions disponibles sont :") + v=sys.version.split() + print(" - Python systeme....: %s"%v[0]) + assert compare_versions(sys.version.split()[0], minimal_python_version) + + def test3_Version(self): + try: + import numpy + print(" - Numpy.............: %s"%numpy.version.version) + assert compare_versions(numpy.version.version, minimal_numpy_version) + except ImportError as e: + raise ImportError(str(e)) + + def test4_Version(self): + try: + import scipy + print(" - Scipy.............: %s"%scipy.version.version) + assert compare_versions(scipy.version.version, minimal_scipy_version) + except ImportError as e: + raise ImportError(str(e)) + + def test5_Version(self): + try: + import nlopt + __version = "%s.%s.%s"%( + nlopt.version_major(), + nlopt.version_minor(), + nlopt.version_bugfix(), + ) + print(" - NLopt.............: %s"%__version) + assert compare_versions(__version, minimal_nlopt_version) + except ImportError as e: + raise ImportError(str(e)) + + def test6_Version(self): + try: + import matplotlib + mplversion = matplotlib.__version__ + print(" - Matplotlib........: %s"%mplversion) + assert compare_versions(mplversion, minimal_matplotlib_version) + # + print("") + backends_OK = [] + backends_KO = [] + backend_now = matplotlib.get_backend() + + for backend in ['bidon', 'pdf', 'pgf', 'Qt4Agg', 'GTK', 'GTKAgg', 'ps', + 'agg', 'cairo', 'MacOSX', 'GTKCairo', 'WXAgg', + 'template', 'TkAgg', 'GTK3Cairo', 'GTK3Agg', 'svg', + 'WebAgg', 'CocoaAgg', 'emf', 'gdk', 'WX']: + try: + matplotlib.use(backend) + backends_OK.append(backend) + except ValueError: + backends_KO.append(backend) + # + print(" Backends disponibles pour Matplotlib %s :"%mplversion) + print(" Defaut initial......: '%s'"%backend_now) + print(" Fonctionnant........:") + for b in backends_OK: + print(" '%s'"%b) + print(" Non fonctionnant....:") + for b in backends_KO: + print(" '%s'"%b) + print(" (Le backend 'bidon' n'est ici que pour verifier le test, il n'existe pas)") + except ImportError as e: + raise ImportError(str(e)) + print("") + print(" Les résultats obtenus sont corrects.") + print("") + # + return 0 def compare_versions(v1,v2): "Comparaison v1 >= v2" @@ -41,78 +132,8 @@ def compare_versions(v1,v2): lv2 = 1e6*v21 + 1e3*v22 + v23 return lv1 >= lv2 -def minimalVersion(): - "Description" - print(" Les versions minimales attendues sont :") - print(" - Python systeme....: %s"%minimal_python_version) - print(" - Numpy.............: %s"%minimal_numpy_version) - print(" - Scipy.............: %s"%minimal_scipy_version) - print(" - Matplotlib........: %s"%minimal_matplotlib_version) - print("") - -import sys -def testSysteme(): - "Test des versions de modules" - print(" Les versions disponibles sont :") - v=sys.version.split() - print(" - Python systeme....: %s"%v[0]) - assert compare_versions(sys.version.split()[0], minimal_python_version) - # - try: - import numpy - print(" - Numpy.............: %s"%numpy.version.version) - assert compare_versions(numpy.version.version, minimal_numpy_version) - except ImportError: - return 1 - # - try: - import scipy - print(" - Scipy.............: %s"%scipy.version.version) - assert compare_versions(scipy.version.version, minimal_scipy_version) - except ImportError: - return 1 - # - try: - import matplotlib - mplversion = matplotlib.__version__ - print(" - Matplotlib........: %s"%mplversion) - assert compare_versions(mplversion, minimal_matplotlib_version) - # - print("") - backends_OK = [] - backends_KO = [] - backend_now = matplotlib.get_backend() - - for backend in ['bidon', 'pdf', 'pgf', 'Qt4Agg', 'GTK', 'GTKAgg', 'ps', - 'agg', 'cairo', 'MacOSX', 'GTKCairo', 'WXAgg', - 'template', 'TkAgg', 'GTK3Cairo', 'GTK3Agg', 'svg', - 'WebAgg', 'CocoaAgg', 'emf', 'gdk', 'WX']: - try: - matplotlib.use(backend) - backends_OK.append(backend) - except ValueError: - backends_KO.append(backend) - # - print(" Backends disponibles pour Matplotlib %s :"%mplversion) - print(" Defaut initial......: '%s'"%backend_now) - print(" Fonctionnant........:") - for b in backends_OK: - print(" '%s'"%b) - print(" Non fonctionnant....:") - for b in backends_KO: - print(" '%s'"%b) - print(" (Le backend 'bidon' n'est ici que pour verifier le test, il n'existe pas)") - except ImportError: - pass - print("") - print(" Les résultats obtenus sont corrects.") - print("") - # - return 0 - -# ============================================================================== +#=============================================================================== if __name__ == "__main__": - print('\nAUTODIAGNOSTIC\n') - minimalVersion() - sys.exit(testSysteme()) - + print("\nAUTODIAGNOSTIC\n==============") + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test1002/Performances.py b/test/test1002/Performances.py index 4b3cde6..df1a70e 100644 --- a/test/test1002/Performances.py +++ b/test/test1002/Performances.py @@ -21,69 +21,100 @@ # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D "Test de fonctionnement et de performances de Numpy et Scipy" -# ============================================================================== -import numpy, time +import sys +import time +import unittest +import numpy +import scipy numpy.set_printoptions(precision=5) -def testSysteme(): - print(" Les caracteristiques des applications et outils systeme :") - import sys ; v=sys.version.split() ; print(" - Python systeme....: %s"%v[0]) - import numpy ; print(" - Numpy.............: %s"%numpy.version.version) - try: - import scipy ; print(" - Scipy.............: %s"%scipy.version.version) - except: - print(" - Scipy.............: %s"%("absent",)) - try: - import numpy.distutils.system_info as sysinfo ; la = sysinfo.get_info('lapack') ; print(" - Lapack............: %s/lib%s.so"%(la['library_dirs'][0],la['libraries'][0])) - except: - print(" - Lapack............: %s"%("absent",)) - print("") - return True +# ============================================================================== +class Test_Adao(unittest.TestCase): + def test1_Systeme(self): + "Test Système" + print() + print(" %s"%self.test1_Systeme.__doc__) + print(" Les caracteristiques des applications et outils systeme :") + import sys ; v=sys.version.split() ; print(" - Python systeme....: %s"%v[0]) + import numpy ; print(" - Numpy.............: %s"%numpy.version.version) + try: + import scipy ; print(" - Scipy.............: %s"%scipy.version.version) + except: + print(" - Scipy.............: %s"%("absent",)) + try: + import numpy.distutils.system_info as sysinfo ; la = sysinfo.get_info('lapack') ; print(" - Lapack............: %s/lib%s.so"%(la['library_dirs'][0],la['libraries'][0])) + except: + print(" - Lapack............: %s"%("absent",)) + print("") + return True -def testNumpy01(dimension = 3, precision = 1.e-17, repetitions = 10): - "Test Numpy" - __d = int(dimension) - print(" Taille du test..................................: %.0e"%__d) - t_init = time.time() - A = numpy.array([numpy.arange(dimension)+1.,]*__d) - x = numpy.arange(__d)+1. - print(" La duree elapsed moyenne de l'initialisation est: %4.1f s"%(time.time()-t_init)) - # - t_init = time.time() - for i in range(repetitions): - b = numpy.dot(A,x) - print(" La duree elapsed pour %3i produits est de.......: %4.1f s"%(repetitions, time.time()-t_init)) - r = [__d*(__d+1.)*(2.*__d+1.)/6.,]*__d - if max(abs(b-r)) > precision: - raise ValueError("Resultat du test errone (1)") - else: - print(" Test correct, erreur maximale inferieure a %s"%precision) - print("") - del A, x, b + def test_Numpy01(self, dimension = 10000, precision = 1.e-17, repetitions = 10): + "Test Numpy" + __d = int(dimension) + print(" %s"%self.test_Numpy01.__doc__) + print(" Taille du test..................................: %.0e"%__d) + t_init = time.time() + A = numpy.array([numpy.arange(dimension)+1.,]*__d) + x = numpy.arange(__d)+1. + print(" La duree elapsed moyenne de l'initialisation est: %4.1f s"%(time.time()-t_init)) + # + t_init = time.time() + for i in range(repetitions): + b = numpy.dot(A,x) + print(" La duree elapsed pour %3i produits est de.......: %4.1f s"%(repetitions, time.time()-t_init)) + r = [__d*(__d+1.)*(2.*__d+1.)/6.,]*__d + if max(abs(b-r)) > precision: + raise ValueError("Resultat du test errone (1)") + else: + print(" Test correct, erreur maximale inferieure a %s"%precision) + print("") + del A, x, b -def testNumpy02(dimension = 3, precision = 1.e-17, repetitions = 100): - "Test Numpy" - __d = int(dimension) - print(" Taille du test..................................: %.0e"%__d) - t_init = time.time() - A = numpy.random.normal(0.,1.,size=(__d,__d)) - x = numpy.random.normal(0.,1.,size=(__d,)) - print(" La duree elapsed moyenne de l'initialisation est: %4.1f s"%(time.time()-t_init)) - # - t_init = time.time() - for i in range(repetitions): - b = numpy.dot(A,x) - print(" La duree elapsed pour %3i produits est de.......: %4.1f s"%(repetitions, time.time()-t_init)) - print("") - del A, x, b + def test_Numpy02(self, dimension = 3000, precision = 1.e-17, repetitions = 100): + "Test Numpy" + __d = int(dimension) + print(" %s"%self.test_Numpy02.__doc__) + print(" Taille du test..................................: %.0e"%__d) + t_init = time.time() + A = numpy.random.normal(0.,1.,size=(__d,__d)) + x = numpy.random.normal(0.,1.,size=(__d,)) + print(" La duree elapsed moyenne de l'initialisation est: %4.1f s"%(time.time()-t_init)) + # + t_init = time.time() + for i in range(repetitions): + b = numpy.dot(A,x) + print(" La duree elapsed pour %3i produits est de.......: %4.1f s"%(repetitions, time.time()-t_init)) + print("") + del A, x, b + + def test_Scipy01(self, dimension = 3000, precision = 1.e-17, repetitions = 10): + "Test Scipy" + __d = int(dimension) + print(" %s"%self.test_Scipy01.__doc__) + print(" Taille du test..................................: %.0e"%__d) + t_init = time.time() + A = numpy.array([numpy.arange(dimension)+1.,]*__d) + x = numpy.arange(__d)+1. + print(" La duree elapsed moyenne de l'initialisation est: %4.1f s"%(time.time()-t_init)) + # + t_init = time.time() + for i in range(repetitions): + b = scipy.dot(A,x) + print(" La duree elapsed pour %3i produits est de.......: %4.1f s"%(repetitions, time.time()-t_init)) + r = [__d*(__d+1.)*(2.*__d+1.)/6.,]*__d + if max(abs(b-r)) > precision: + raise ValueError("Resultat du test errone (1)") + else: + print(" Test correct, erreur maximale inferieure a %s"%precision) + print("") + del A, x, b # ============================================================================== if __name__ == "__main__": - print('\nAUTODIAGNOSTIC\n') - testSysteme() numpy.random.seed(1000) - testNumpy01(dimension = 1.e4) - testNumpy02(dimension = 3.e3) + print("\nAUTODIAGNOSTIC\n==============") + sys.stderr = sys.stdout + unittest.main(verbosity=2) print("") print(" Les résultats obtenus sont corrects.") print("") diff --git a/test/test6701/Doc_TUI_Exemple_01.py b/test/test6701/Doc_TUI_Exemple_01.py index 4846741..669bce4 100644 --- a/test/test6701/Doc_TUI_Exemple_01.py +++ b/test/test6701/Doc_TUI_Exemple_01.py @@ -21,22 +21,37 @@ # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D "Verification d'un exemple de la documentation" +import sys +import unittest + # ============================================================================== -def test1(): - """Test""" - from numpy import array, matrix - from adao import adaoBuilder - case = adaoBuilder.New() - case.set( 'AlgorithmParameters', Algorithm='3DVAR' ) - case.set( 'Background', Vector=[0, 1, 2] ) - case.set( 'BackgroundError', ScalarSparseMatrix=1.0 ) - case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) ) - case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' ) - case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' ) - case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" ) - case.execute() - # - return case.get("Analysis")[-1] +class Test_Adao(unittest.TestCase): + def test1(self): + """Test""" + print("""Exemple de la doc : + + Un exemple simple de creation d'un cas de calcul TUI ADAO + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + """) + #--------------------------------------------------------------------------- + from numpy import array, matrix + from adao import adaoBuilder + case = adaoBuilder.New() + case.set( 'AlgorithmParameters', Algorithm='3DVAR' ) + case.set( 'Background', Vector=[0, 1, 2] ) + case.set( 'BackgroundError', ScalarSparseMatrix=1.0 ) + case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) ) + case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' ) + case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' ) + case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" ) + case.execute() + #--------------------------------------------------------------------------- + xa = case.get("Analysis")[-1] + ecart = assertAlmostEqualArrays(xa, [0.25, 0.80, 0.95], places = 5) + print("") + print(" L'écart absolu maximal obtenu lors du test est de %.2e."%ecart) + print(" Les résultats obtenus sont corrects.") + print("") # ============================================================================== def assertAlmostEqualArrays(first, second, places=7, msg=None, delta=None): @@ -45,24 +60,15 @@ def assertAlmostEqualArrays(first, second, places=7, msg=None, delta=None): if msg is not None: print(msg) if delta is not None: - if ( (numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any(): + if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any(): raise AssertionError("%s != %s within %s places"%(first,second,delta)) else: - if ( (numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any(): + if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any(): raise AssertionError("%s != %s within %i places"%(first,second,places)) return max(abs(numpy.asarray(first) - numpy.asarray(second))) # ============================================================================== if __name__ == "__main__": print('\nAUTODIAGNOSTIC\n') - print("""Exemple de la doc : - - Un exemple simple de creation d'un cas de calcul TUI ADAO - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - """) - xa = test1() - ecart = assertAlmostEqualArrays(xa, [0.25, 0.80, 0.95], places = 5) - print("") - print(" L'écart absolu maximal obtenu lors du test est de %.2e."%ecart) - print(" Les résultats obtenus sont corrects.") - print("") + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6702/Doc_TUI_Exemple_02.py b/test/test6702/Doc_TUI_Exemple_02.py index e6af4ac..70120fc 100644 --- a/test/test6702/Doc_TUI_Exemple_02.py +++ b/test/test6702/Doc_TUI_Exemple_02.py @@ -21,47 +21,72 @@ # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D "Verification d'un exemple de la documentation" +import sys +import unittest + # ============================================================================== -def test1(): - """Test""" - from numpy import array, matrix - from adao import adaoBuilder - case = adaoBuilder.New() - case.set( 'AlgorithmParameters', Algorithm='3DVAR' ) - case.set( 'Background', Vector=[0, 1, 2] ) - case.set( 'BackgroundError', ScalarSparseMatrix=1.0 ) - case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) ) - case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' ) - case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' ) - case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" ) - case.execute() - # - return case.get("Analysis")[-1] +class Test_Adao(unittest.TestCase): + results = [] + def test1(self): + """Test""" + print("""Exemple de la doc : + + Creation detaillee d'un cas de calcul TUI ADAO + ++++++++++++++++++++++++++++++++++++++++++++++ + Les deux resultats sont testes pour etre identiques. + """) + from numpy import array, matrix + from adao import adaoBuilder + case = adaoBuilder.New() + case.set( 'AlgorithmParameters', Algorithm='3DVAR' ) + case.set( 'Background', Vector=[0, 1, 2] ) + case.set( 'BackgroundError', ScalarSparseMatrix=1.0 ) + case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) ) + case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' ) + case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' ) + case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" ) + case.execute() + # + xa = case.get("Analysis")[-1] + Test_Adao.results.append( xa ) + return xa -def test2(): - """Test""" - from numpy import array, matrix - from adao import adaoBuilder - case = adaoBuilder.New() - case.set( 'AlgorithmParameters', Algorithm='3DVAR' ) - case.set( 'Background', Vector=[0, 1, 2] ) - case.set( 'BackgroundError', ScalarSparseMatrix=1.0 ) - case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) ) - case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' ) - def simulation(x): - import numpy - __x = numpy.matrix(numpy.ravel(numpy.matrix(x))).T - __H = numpy.matrix("1 0 0;0 2 0;0 0 3") - return __H * __x - # - case.set( 'ObservationOperator', - OneFunction = simulation, - Parameters = {"DifferentialIncrement":0.01}, - ) - case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" ) - case.execute() - # - return case.get("Analysis")[-1] + def test2(self): + """Test""" + from numpy import array, matrix + from adao import adaoBuilder + case = adaoBuilder.New() + case.set( 'AlgorithmParameters', Algorithm='3DVAR' ) + case.set( 'Background', Vector=[0, 1, 2] ) + case.set( 'BackgroundError', ScalarSparseMatrix=1.0 ) + case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) ) + case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' ) + def simulation(x): + import numpy + __x = numpy.matrix(numpy.ravel(numpy.matrix(x))).T + __H = numpy.matrix("1 0 0;0 2 0;0 0 3") + return __H * __x + # + case.set( 'ObservationOperator', + OneFunction = simulation, + Parameters = {"DifferentialIncrement":0.01}, + ) + case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" ) + case.execute() + # + xa = case.get("Analysis")[-1] + Test_Adao.results.append( xa ) + return xa + + def test3(self): + """Test""" + xa2 = Test_Adao.results.pop() + xa1 = Test_Adao.results.pop() + ecart = assertAlmostEqualArrays(xa1, xa2, places = 15) + print("") + print(" L'écart absolu maximal obtenu lors du test est de %.2e."%ecart) + print(" Les résultats obtenus sont corrects.") + print("") # ============================================================================== def assertAlmostEqualArrays(first, second, places=7, msg=None, delta=None): @@ -70,26 +95,15 @@ def assertAlmostEqualArrays(first, second, places=7, msg=None, delta=None): if msg is not None: print(msg) if delta is not None: - if ( (numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any(): + if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any(): raise AssertionError("%s != %s within %s places"%(first,second,delta)) else: - if ( (numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any(): + if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any(): raise AssertionError("%s != %s within %i places"%(first,second,places)) return max(abs(numpy.asarray(first) - numpy.asarray(second))) # ============================================================================== if __name__ == "__main__": print('\nAUTODIAGNOSTIC\n') - print("""Exemple de la doc : - - Creation detaillee d'un cas de calcul TUI ADAO - ++++++++++++++++++++++++++++++++++++++++++++++ - Les deux resultats sont testes pour etre identiques. - """) - xa1 = test1() - xa2 = test2() - ecart = assertAlmostEqualArrays(xa1, xa2, places = 15) - print("") - print(" L'écart absolu maximal obtenu lors du test est de %.2e."%ecart) - print(" Les résultats obtenus sont corrects.") - print("") + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6703/Doc_TUI_Exemple_03.py b/test/test6703/Doc_TUI_Exemple_03.py index 4d70372..69413a7 100644 --- a/test/test6703/Doc_TUI_Exemple_03.py +++ b/test/test6703/Doc_TUI_Exemple_03.py @@ -21,6 +21,9 @@ # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D "Verification d'un exemple de la documentation" +import sys +import unittest + # ============================================================================== # # Construction artificielle d'un exemple de donnees utilisateur @@ -45,61 +48,76 @@ def simulation(x): observations = simulation((2, 3, 4)) # ============================================================================== -def test1(): - "Test" - import numpy - from adao import adaoBuilder - # - # Mise en forme des entrees - # ------------------------- - Xb = (alpha, beta, gamma) - Bounds = ( - (alphamin, alphamax), - (betamin, betamax ), - (gammamin, gammamax)) - # - # TUI ADAO - # -------- - case = adaoBuilder.New() - case.set( - 'AlgorithmParameters', - Algorithm = '3DVAR', - Parameters = { - "Bounds":Bounds, - "MaximumNumberOfSteps":100, - "StoreSupplementaryCalculations":[ - "CostFunctionJ", - "CurrentState", - "SimulatedObservationAtOptimum", - ], - } - ) - case.set( 'Background', Vector = numpy.array(Xb), Stored = True ) - case.set( 'Observation', Vector = numpy.array(observations) ) - case.set( 'BackgroundError', ScalarSparseMatrix = 1.0e10 ) - case.set( 'ObservationError', ScalarSparseMatrix = 1.0 ) - case.set( - 'ObservationOperator', - OneFunction = simulation, - Parameters = {"DifferentialIncrement":0.0001}, - ) - case.set( 'Observer', Variable="CurrentState", Template="ValuePrinter" ) - case.execute() - # - # Exploitation independante - # ------------------------- - Xbackground = case.get("Background") - Xoptimum = case.get("Analysis")[-1] - FX_at_optimum = case.get("SimulatedObservationAtOptimum")[-1] - J_values = case.get("CostFunctionJ")[:] - print("") - print("Number of internal iterations...: %i"%len(J_values)) - print("Initial state...................: %s"%(numpy.ravel(Xbackground),)) - print("Optimal state...................: %s"%(numpy.ravel(Xoptimum),)) - print("Simulation at optimal state.....: %s"%(numpy.ravel(FX_at_optimum),)) - print("") - # - return case.get("Analysis")[-1] +class Test_Adao(unittest.TestCase): + def test1(self): + "Test" + print("""Exemple de la doc : + + Exploitation independante des resultats d'un cas de calcul + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + """) + #--------------------------------------------------------------------------- + import numpy + from adao import adaoBuilder + # + # Mise en forme des entrees + # ------------------------- + Xb = (alpha, beta, gamma) + Bounds = ( + (alphamin, alphamax), + (betamin, betamax ), + (gammamin, gammamax)) + # + # TUI ADAO + # -------- + case = adaoBuilder.New() + case.set( + 'AlgorithmParameters', + Algorithm = '3DVAR', + Parameters = { + "Bounds":Bounds, + "MaximumNumberOfSteps":100, + "StoreSupplementaryCalculations":[ + "CostFunctionJ", + "CurrentState", + "SimulatedObservationAtOptimum", + ], + } + ) + case.set( 'Background', Vector = numpy.array(Xb), Stored = True ) + case.set( 'Observation', Vector = numpy.array(observations) ) + case.set( 'BackgroundError', ScalarSparseMatrix = 1.0e10 ) + case.set( 'ObservationError', ScalarSparseMatrix = 1.0 ) + case.set( + 'ObservationOperator', + OneFunction = simulation, + Parameters = {"DifferentialIncrement":0.0001}, + ) + case.set( 'Observer', Variable="CurrentState", Template="ValuePrinter" ) + case.execute() + # + # Exploitation independante + # ------------------------- + Xbackground = case.get("Background") + Xoptimum = case.get("Analysis")[-1] + FX_at_optimum = case.get("SimulatedObservationAtOptimum")[-1] + J_values = case.get("CostFunctionJ")[:] + print("") + print("Number of internal iterations...: %i"%len(J_values)) + print("Initial state...................: %s"%(numpy.ravel(Xbackground),)) + print("Optimal state...................: %s"%(numpy.ravel(Xoptimum),)) + print("Simulation at optimal state.....: %s"%(numpy.ravel(FX_at_optimum),)) + print("") + # + #--------------------------------------------------------------------------- + xa = case.get("Analysis")[-1] + ecart = assertAlmostEqualArrays(xa, [ 2., 3., 4.]) + # + print(" L'écart absolu maximal obtenu lors du test est de %.2e."%ecart) + print(" Les résultats obtenus sont corrects.") + print("") + # + return xa # ============================================================================== def assertAlmostEqualArrays(first, second, places=7, msg=None, delta=None): @@ -118,14 +136,5 @@ def assertAlmostEqualArrays(first, second, places=7, msg=None, delta=None): # ============================================================================== if __name__ == "__main__": print('\nAUTODIAGNOSTIC\n') - print("""Exemple de la doc : - - Exploitation independante des resultats d'un cas de calcul - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - """) - xa = test1() - ecart = assertAlmostEqualArrays(xa, [ 2., 3., 4.]) - # - print(" L'écart absolu maximal obtenu lors du test est de %.2e."%ecart) - print(" Les résultats obtenus sont corrects.") - print("") + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6704/Doc_TUI_Exemple_03_en_multifonction.py b/test/test6704/Doc_TUI_Exemple_03_en_multifonction.py index ddf12a8..090bad9 100644 --- a/test/test6704/Doc_TUI_Exemple_03_en_multifonction.py +++ b/test/test6704/Doc_TUI_Exemple_03_en_multifonction.py @@ -21,6 +21,9 @@ # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D "Verification d'un exemple de la documentation" +import sys +import unittest + # ============================================================================== # # Construction artificielle d'un exemple de donnees utilisateur @@ -51,62 +54,77 @@ def multisimulation( xserie ): observations = simulation((2, 3, 4)) # ============================================================================== -def test1(): - "Test" - import numpy - from adao import adaoBuilder - # - # Mise en forme des entrees - # ------------------------- - Xb = (alpha, beta, gamma) - Bounds = ( - (alphamin, alphamax), - (betamin, betamax ), - (gammamin, gammamax)) - # - # TUI ADAO - # -------- - case = adaoBuilder.New() - case.set( - 'AlgorithmParameters', - Algorithm = '3DVAR', - Parameters = { - "Bounds":Bounds, - "MaximumNumberOfSteps":100, - "StoreSupplementaryCalculations":[ - "CostFunctionJ", - "CurrentState", - "SimulatedObservationAtOptimum", - ], - } - ) - case.set( 'Background', Vector = numpy.array(Xb), Stored = True ) - case.set( 'Observation', Vector = numpy.array(observations) ) - case.set( 'BackgroundError', ScalarSparseMatrix = 1.0e10 ) - case.set( 'ObservationError', ScalarSparseMatrix = 1.0 ) - case.set( - 'ObservationOperator', - OneFunction = multisimulation, - Parameters = {"DifferentialIncrement":0.0001}, - InputFunctionAsMulti = True, - ) - case.set( 'Observer', Variable="CurrentState", Template="ValuePrinter" ) - case.execute() - # - # Exploitation independante - # ------------------------- - Xbackground = case.get("Background") - Xoptimum = case.get("Analysis")[-1] - FX_at_optimum = case.get("SimulatedObservationAtOptimum")[-1] - J_values = case.get("CostFunctionJ")[:] - print("") - print("Number of internal iterations...: %i"%len(J_values)) - print("Initial state...................: %s"%(numpy.ravel(Xbackground),)) - print("Optimal state...................: %s"%(numpy.ravel(Xoptimum),)) - print("Simulation at optimal state.....: %s"%(numpy.ravel(FX_at_optimum),)) - print("") - # - return case.get("Analysis")[-1] +class Test_Adao(unittest.TestCase): + def test1(self): + "Test" + print("""Exemple de la doc : + + Exploitation independante des resultats d'un cas de calcul + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + """) + #--------------------------------------------------------------------------- + import numpy + from adao import adaoBuilder + # + # Mise en forme des entrees + # ------------------------- + Xb = (alpha, beta, gamma) + Bounds = ( + (alphamin, alphamax), + (betamin, betamax ), + (gammamin, gammamax)) + # + # TUI ADAO + # -------- + case = adaoBuilder.New() + case.set( + 'AlgorithmParameters', + Algorithm = '3DVAR', + Parameters = { + "Bounds":Bounds, + "MaximumNumberOfSteps":100, + "StoreSupplementaryCalculations":[ + "CostFunctionJ", + "CurrentState", + "SimulatedObservationAtOptimum", + ], + } + ) + case.set( 'Background', Vector = numpy.array(Xb), Stored = True ) + case.set( 'Observation', Vector = numpy.array(observations) ) + case.set( 'BackgroundError', ScalarSparseMatrix = 1.0e10 ) + case.set( 'ObservationError', ScalarSparseMatrix = 1.0 ) + case.set( + 'ObservationOperator', + OneFunction = multisimulation, + Parameters = {"DifferentialIncrement":0.0001}, + InputFunctionAsMulti = True, + ) + case.set( 'Observer', Variable="CurrentState", Template="ValuePrinter" ) + case.execute() + # + # Exploitation independante + # ------------------------- + Xbackground = case.get("Background") + Xoptimum = case.get("Analysis")[-1] + FX_at_optimum = case.get("SimulatedObservationAtOptimum")[-1] + J_values = case.get("CostFunctionJ")[:] + print("") + print("Number of internal iterations...: %i"%len(J_values)) + print("Initial state...................: %s"%(numpy.ravel(Xbackground),)) + print("Optimal state...................: %s"%(numpy.ravel(Xoptimum),)) + print("Simulation at optimal state.....: %s"%(numpy.ravel(FX_at_optimum),)) + print("") + # + #--------------------------------------------------------------------------- + xa = case.get("Analysis")[-1] + ecart = assertAlmostEqualArrays(xa, [ 2., 3., 4.]) + # + print(" L'écart absolu maximal obtenu lors du test est de %.2e."%ecart) + print(" Les résultats obtenus sont corrects.") + print("") + # + return xa # ============================================================================== def assertAlmostEqualArrays(first, second, places=7, msg=None, delta=None): @@ -125,14 +143,5 @@ def assertAlmostEqualArrays(first, second, places=7, msg=None, delta=None): # ============================================================================== if __name__ == "__main__": print('\nAUTODIAGNOSTIC\n') - print("""Exemple de la doc : - - Exploitation independante des resultats d'un cas de calcul - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - """) - xa = test1() - ecart = assertAlmostEqualArrays(xa, [ 2., 3., 4.]) - # - print(" L'écart absolu maximal obtenu lors du test est de %.2e."%ecart) - print(" Les résultats obtenus sont corrects.") - print("") + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6711/Doc_TUI_Exemple_01_Savings.py b/test/test6711/Doc_TUI_Exemple_01_Savings.py index 839b538..376ca7f 100644 --- a/test/test6711/Doc_TUI_Exemple_01_Savings.py +++ b/test/test6711/Doc_TUI_Exemple_01_Savings.py @@ -21,64 +21,78 @@ # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D "Verification d'un exemple de la documentation" -import os, pprint +import sys, os, pprint +import unittest # ============================================================================== -def test1(): - """Test""" - from numpy import array, matrix - from adao import adaoBuilder - case = adaoBuilder.New() - case.set( 'AlgorithmParameters', Algorithm='3DVAR' ) - case.set( 'Background', Vector=[0, 1, 2] ) - case.set( 'BackgroundError', ScalarSparseMatrix=1.0 ) - case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) ) - case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' ) - case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' ) - case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" ) - # - case.setObserver("Analysis", String="print('==> Nombre d analyses : %i'%len(var))") - # - case.execute() - # - base_file = "output_test6711" - print("") - print("#===============================================================================") - # - print("#=== Restitution en dictionnaire basique =======================================") - case.get() - print("#===============================================================================") - # - print("#=== Restitution en fichier TUI ================================================") - # print(case.dump(FileName=base_file+"_TUI.py", Formater="TUI")) - case.dump(FileName=base_file+"_TUI.py", Formater="TUI") - print("#===============================================================================") - # - print("#=== Restitution en fichier SCD ================================================") - # print(case.dump(FileName=base_file+"_SCD.py", Formater="SCD")) - case.dump(FileName=base_file+"_SCD.py", Formater="SCD") - print("#===============================================================================") - # - # print("#=== Restitution en fichier YACS ===============================================") - # # print(case.dump(FileName=base_file+"_YACS.xml", Formater="YACS")) - # case.dump(FileName=base_file+"_YACS.xml", Formater="YACS") - # print("#===============================================================================") - # - print("") - cwd = os.getcwd() - for f in [ - base_file+"_TUI.py", - base_file+"_SCD.py", - # base_file+"_YACS.xml", - ]: - if os.path.exists(os.path.abspath(cwd+"/"+f)): - print("#=== Fichier \"%s\" correctement généré"%f) - os.remove(os.path.abspath(cwd+"/"+f)) - else: - raise ValueError("Fichier \"%s\" inexistant"%f) - print("") - # - return case.get("Analysis")[-1] +class Test_Adao(unittest.TestCase): + def test1(self): + """Test""" + print("""Exemple de la doc : + + Cas-test vérifiant les conversions + ++++++++++++++++++++++++++++++++++\n""") + #----------------------------------------------------------------------- + from numpy import array, matrix + from adao import adaoBuilder + case = adaoBuilder.New() + case.set( 'AlgorithmParameters', Algorithm='3DVAR' ) + case.set( 'Background', Vector=[0, 1, 2] ) + case.set( 'BackgroundError', ScalarSparseMatrix=1.0 ) + case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) ) + case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' ) + case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' ) + case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" ) + # + case.setObserver("Analysis", String="print('==> Nombre d analyses : %i'%len(var))") + # + case.execute() + # + base_file = "output_test6711" + print("") + print("#===============================================================================") + # + print("#=== Restitution en dictionnaire basique =======================================") + case.get() + print("#===============================================================================") + # + print("#=== Restitution en fichier TUI ================================================") + # print(case.dump(FileName=base_file+"_TUI.py", Formater="TUI")) + case.dump(FileName=base_file+"_TUI.py", Formater="TUI") + print("#===============================================================================") + # + print("#=== Restitution en fichier SCD ================================================") + # print(case.dump(FileName=base_file+"_SCD.py", Formater="SCD")) + case.dump(FileName=base_file+"_SCD.py", Formater="SCD") + print("#===============================================================================") + # + # print("#=== Restitution en fichier YACS ===============================================") + # # print(case.dump(FileName=base_file+"_YACS.xml", Formater="YACS")) + # case.dump(FileName=base_file+"_YACS.xml", Formater="YACS") + # print("#===============================================================================") + # + print("") + cwd = os.getcwd() + for f in [ + base_file+"_TUI.py", + base_file+"_SCD.py", + # base_file+"_YACS.xml", + ]: + if os.path.exists(os.path.abspath(cwd+"/"+f)): + print("#=== Fichier \"%s\" correctement généré"%f) + os.remove(os.path.abspath(cwd+"/"+f)) + else: + raise ValueError("Fichier \"%s\" inexistant"%f) + print("") + #----------------------------------------------------------------------- + xa = case.get("Analysis")[-1] + ecart = assertAlmostEqualArrays(xa, [0.25, 0.80, 0.95], places = 5) + # + print(" L'écart absolu maximal obtenu lors du test est de %.2e."%ecart) + print(" Les résultats obtenus sont corrects.") + print("") + # + return xa # ============================================================================== def assertAlmostEqualArrays(first, second, places=7, msg=None, delta=None): @@ -96,15 +110,6 @@ def assertAlmostEqualArrays(first, second, places=7, msg=None, delta=None): # ============================================================================== if __name__ == "__main__": - print('\n AUTODIAGNOSTIC\n') - print("""Exemple de la doc : - - Cas-test vérifiant les conversions - ++++++++++++++++++++++++++++++++++ -""") - xa = test1() - ecart = assertAlmostEqualArrays(xa, [0.25, 0.80, 0.95], places = 5) - # - print(" L'écart absolu maximal obtenu lors du test est de %.2e."%ecart) - print(" Les résultats obtenus sont corrects.") - print("") + print('\nAUTODIAGNOSTIC\n') + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6901/Verification_des_Assimilation_Algorithms.py b/test/test6901/Verification_des_Assimilation_Algorithms.py index 3523dcd..e1728b1 100644 --- a/test/test6901/Verification_des_Assimilation_Algorithms.py +++ b/test/test6901/Verification_des_Assimilation_Algorithms.py @@ -27,7 +27,7 @@ import numpy from adao import adaoBuilder # ============================================================================== -class InTest(unittest.TestCase): +class Test_Adao(unittest.TestCase): def test1(self): """Verification de la disponibilite de l'ensemble des algorithmes\n(Utilisation d'un operateur matriciel)""" print(self.test1.__doc__) @@ -205,4 +205,5 @@ def verify_similarity_of_algo_results(serie = [], Xa = {}, precision = 1.e-15): #=============================================================================== if __name__ == "__main__": print("\nAUTODIAGNOSTIC\n==============") - unittest.main() + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6902/Verification_des_Checking_Algorithms.py b/test/test6902/Verification_des_Checking_Algorithms.py index d9f3b1c..6a28652 100644 --- a/test/test6902/Verification_des_Checking_Algorithms.py +++ b/test/test6902/Verification_des_Checking_Algorithms.py @@ -26,7 +26,7 @@ import numpy from adao import adaoBuilder # ============================================================================== -class InTest(unittest.TestCase): +class Test_Adao(unittest.TestCase): def test1(self): for algo in ("AdjointTest", "FunctionTest", "GradientTest", "LinearityTest", "TangentTest"): print("") @@ -81,4 +81,5 @@ class InTest(unittest.TestCase): #=============================================================================== if __name__ == "__main__": print("\nAUTODIAGNOSTIC\n==============") - unittest.main() + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6903/Verification_des_mono_et_multi_fonctions_A.py b/test/test6903/Verification_des_mono_et_multi_fonctions_A.py index 5dffc27..a4cf22a 100644 --- a/test/test6903/Verification_des_mono_et_multi_fonctions_A.py +++ b/test/test6903/Verification_des_mono_et_multi_fonctions_A.py @@ -39,7 +39,7 @@ def MultiFonction( xserie ): return _mulHX # ============================================================================== -class InTest(unittest.TestCase): +class Test_Adao(unittest.TestCase): def test1(self): """ Verification du fonctionnement identique pour les algorithmes non-temporels @@ -110,4 +110,5 @@ def verify_similarity_of_algo_results(serie = [], Xa = {}, precision = 1.e-15): #=============================================================================== if __name__ == "__main__": print("\nAUTODIAGNOSTIC\n==============") - unittest.main() + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6903/Verification_des_mono_et_multi_fonctions_B.py b/test/test6903/Verification_des_mono_et_multi_fonctions_B.py index 0240905..e9a8a1a 100644 --- a/test/test6903/Verification_des_mono_et_multi_fonctions_B.py +++ b/test/test6903/Verification_des_mono_et_multi_fonctions_B.py @@ -39,7 +39,7 @@ def MultiFonction( xserie ): return _mulHX # ============================================================================== -class InTest(unittest.TestCase): +class Test_Adao(unittest.TestCase): def test1(self): """ Verification du fonctionnement identique pour les algorithmes temporels @@ -114,4 +114,5 @@ def verify_similarity_of_algo_results(serie = [], Xa = {}, precision = 1.e-15): #=============================================================================== if __name__ == "__main__": print("\nAUTODIAGNOSTIC\n==============") - unittest.main() + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6903/Verification_des_mono_et_multi_fonctions_C.py b/test/test6903/Verification_des_mono_et_multi_fonctions_C.py index d705066..8e82dba 100644 --- a/test/test6903/Verification_des_mono_et_multi_fonctions_C.py +++ b/test/test6903/Verification_des_mono_et_multi_fonctions_C.py @@ -39,7 +39,7 @@ def MultiFonction( xserie ): return _mulHX # ============================================================================== -class InTest(unittest.TestCase): +class Test_Adao(unittest.TestCase): def test1(self): """ Verification du fonctionnement identique pour les algorithmes autres @@ -110,4 +110,5 @@ def verify_similarity_of_algo_results(serie = [], Xa = {}, precision = 1.e-15): #=============================================================================== if __name__ == "__main__": print("\nAUTODIAGNOSTIC\n==============") - unittest.main() + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6903/Verification_des_mono_et_multi_fonctions_D.py b/test/test6903/Verification_des_mono_et_multi_fonctions_D.py index 66d1f43..93fc983 100644 --- a/test/test6903/Verification_des_mono_et_multi_fonctions_D.py +++ b/test/test6903/Verification_des_mono_et_multi_fonctions_D.py @@ -67,7 +67,7 @@ def MultiFonction01( xSerie ): return _ySerie # ============================================================================== -class InTest(unittest.TestCase): +class Test_Adao(unittest.TestCase): def test1(self): """ Verification du fonctionnement identique pour les algorithmes non-temporels @@ -138,4 +138,5 @@ def verify_similarity_of_algo_results(serie = [], Xa = {}, precision = 1.e-15): #=============================================================================== if __name__ == "__main__": print("\nAUTODIAGNOSTIC\n==============") - unittest.main() + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6903/Verification_des_mono_et_multi_fonctions_E.py b/test/test6903/Verification_des_mono_et_multi_fonctions_E.py index 66dd89d..2c60a86 100644 --- a/test/test6903/Verification_des_mono_et_multi_fonctions_E.py +++ b/test/test6903/Verification_des_mono_et_multi_fonctions_E.py @@ -67,7 +67,7 @@ def MultiFonction01( xSerie ): return _ySerie # ============================================================================== -class InTest(unittest.TestCase): +class Test_Adao(unittest.TestCase): def test1(self): """ Verification du fonctionnement identique pour les algorithmes temporels @@ -142,4 +142,5 @@ def verify_similarity_of_algo_results(serie = [], Xa = {}, precision = 1.e-15): #=============================================================================== if __name__ == "__main__": print("\nAUTODIAGNOSTIC\n==============") - unittest.main() + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6903/Verification_des_mono_et_multi_fonctions_F.py b/test/test6903/Verification_des_mono_et_multi_fonctions_F.py index 98d3da8..6e47fc2 100644 --- a/test/test6903/Verification_des_mono_et_multi_fonctions_F.py +++ b/test/test6903/Verification_des_mono_et_multi_fonctions_F.py @@ -67,7 +67,7 @@ def MultiFonction01( xSerie ): return _ySerie # ============================================================================== -class InTest(unittest.TestCase): +class Test_Adao(unittest.TestCase): def test1(self): """ Verification du fonctionnement identique pour les algorithmes autres @@ -138,4 +138,5 @@ def verify_similarity_of_algo_results(serie = [], Xa = {}, precision = 1.e-15): #=============================================================================== if __name__ == "__main__": print("\nAUTODIAGNOSTIC\n==============") - unittest.main() + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6904/Definition_complete_de_cas_3DVAR.py b/test/test6904/Definition_complete_de_cas_3DVAR.py index 67cbfac..9e3a899 100644 --- a/test/test6904/Definition_complete_de_cas_3DVAR.py +++ b/test/test6904/Definition_complete_de_cas_3DVAR.py @@ -55,7 +55,7 @@ def multisimulation( xserie ): observations = simulation((2, 3, 4)) # ============================================================================== -class InTest(unittest.TestCase): +class Test_Adao(unittest.TestCase): def test1(self): print(""" Full definition of a use case for the standard user @@ -166,4 +166,5 @@ def assertAlmostEqualArrays(first, second, places=7, msg=None, delta=None): # ============================================================================== if __name__ == '__main__': print("\nAUTODIAGNOSTIC\n==============") - unittest.main() + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6904/Definition_complete_de_cas_Blue.py b/test/test6904/Definition_complete_de_cas_Blue.py index dad2cbc..057d073 100644 --- a/test/test6904/Definition_complete_de_cas_Blue.py +++ b/test/test6904/Definition_complete_de_cas_Blue.py @@ -55,7 +55,7 @@ def multisimulation( xserie ): observations = simulation((2, 3, 4)) # ============================================================================== -class InTest(unittest.TestCase): +class Test_Adao(unittest.TestCase): def test1(self): print(""" Full definition of a use case for the standard user @@ -163,4 +163,5 @@ def assertAlmostEqualArrays(first, second, places=7, msg=None, delta=None): # ============================================================================== if __name__ == '__main__': print("\nAUTODIAGNOSTIC\n==============") - unittest.main() + sys.stderr = sys.stdout + unittest.main(verbosity=2) diff --git a/test/test6904/Definition_complete_de_cas_NLLS.py b/test/test6904/Definition_complete_de_cas_NLLS.py index ab0e44f..f2960cd 100644 --- a/test/test6904/Definition_complete_de_cas_NLLS.py +++ b/test/test6904/Definition_complete_de_cas_NLLS.py @@ -55,7 +55,7 @@ def multisimulation( xserie ): observations = simulation((2, 3, 4)) # ============================================================================== -class InTest(unittest.TestCase): +class Test_Adao(unittest.TestCase): def test1(self): print(""" Full definition of a use case for the standard user @@ -161,4 +161,5 @@ def assertAlmostEqualArrays(first, second, places=7, msg=None, delta=None): # ============================================================================== if __name__ == '__main__': print("\nAUTODIAGNOSTIC\n==============") - unittest.main() + sys.stderr = sys.stdout + unittest.main(verbosity=2) -- 2.39.2