Salome HOME
Correction and support extension of YACS/TUI export (4)
[modules/adao.git] / test / test6905 / Verification_de_conversion_de_COMM_en_SCD.py
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (C) 2008-2020 EDF R&D
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 #
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #
21 # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
22 "COMM/TUI/SCD/YACS: Conversion utilities verification"
23
24 import sys, glob
25 import unittest
26 import numpy
27
28 fichiers = glob.glob("*.comm")
29
30 # ==============================================================================
31 class Test_Adao(unittest.TestCase):
32     def test1(self):
33         self.maxDiff = None
34         print("""
35         Conversion utilities verification (COM->SCD)
36         ++++++++++++++++++++++++++++++++++++++++++++
37         """)
38         #
39         import numpy
40         from adao import adaoBuilder
41         #
42         for fichier in fichiers:
43             basename = fichier.rstrip(".comm")
44             #
45             print("        Processing \"%s\""%basename)
46             with open(basename+".comm") as fid:
47                 comm_content = fid.read()
48                 #
49                 comm_content = comm_content.replace("test001_ADAO_External_variables", "test914_Xternal_3_Variables")
50                 comm_content = comm_content.replace("test020_Observation_and_Simulation", "test914_Xternal_4_Variables")
51                 comm_content = comm_content.replace("test033_ADAO_Elementary_FunctionTest_Operators", "test914_Xternal_5_Variables")
52                 #
53                 case = adaoBuilder.New()
54                 case.load( Content=comm_content, Formater="COM" )
55                 texte = case.dump(Formater="SCD")
56                 del case
57                 #
58                 print("        ---> Ok, SCD file of COMM conversion is correct\n")
59
60 # ==============================================================================
61 if __name__ == '__main__':
62     print("\nAUTODIAGNOSTIC\n==============")
63     sys.stderr = sys.stdout
64     unittest.main(verbosity=2)