11import sys
22import os
3+ import pytest
4+ from suds import WebFault
5+
36PROJECT_ROOT = os .path .abspath (os .path .join (
47 os .path .dirname (__file__ ),
58 os .pardir )
@@ -26,38 +29,23 @@ def test_result_tables():
2629 assert ResultTables .MembersInternalForces (CaseObjectType .E_OBJECT_TYPE_LOAD_COMBINATION , 1 , 2 )
2730 assert ResultTables .MembersInternalForcesBySection (CaseObjectType .E_OBJECT_TYPE_LOAD_COMBINATION , 1 , 2 )
2831 assert ResultTables .MembersLocalDeformations (CaseObjectType .E_OBJECT_TYPE_LOAD_COMBINATION , 1 , 1 )
29-
30- try :
31- assert not ResultTables .MembersLocalDeformations (CaseObjectType .E_OBJECT_TYPE_LOAD_COMBINATION , 1 , 4 )
32- except Exception as e :
33- assert 'Specified object does not exist.' in str (e )
34-
35- try :
36- assert not ResultTables .MembersInternalForcesBySection (CaseObjectType .E_OBJECT_TYPE_LOAD_COMBINATION , 1 , 3 )
37- except Exception as e :
38- assert 'Specified object does not exist.' in str (e )
39-
40-
32+ with pytest .raises (WebFault , match = 'Specified object does not exist.' ):
33+ ResultTables .MembersLocalDeformations (CaseObjectType .E_OBJECT_TYPE_LOAD_COMBINATION , 1 , 4 )
34+ with pytest .raises (WebFault , match = 'Specified object does not exist.' ):
35+ ResultTables .MembersInternalForcesBySection (CaseObjectType .E_OBJECT_TYPE_LOAD_COMBINATION , 1 , 3 )
4136
4237 #LC1
4338 assert ResultTables .MembersStrains (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 1 ,1 )
4439 assert ResultTables .NodesDeformations (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 1 , 20 )
45-
46- try :
47- assert not ResultTables .NodesDeformations (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 1 , 5 )
48- except Exception as e :
49- assert 'Specified object does not exist.' in str (e )
50-
40+ with pytest .raises (WebFault , match = 'Specified object does not exist.' ):
41+ ResultTables .NodesDeformations (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 1 , 5 )
5142 assert ResultTables .NodesSupportForces (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 1 , 16 )
5243 assert ResultTables .Summary (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 1 )
5344 assert ResultTables .SurfacesBasicInternalForces (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 1 , 4 )
5445
5546 #LC2
56- try :
57- assert not ResultTables .SurfacesBasicStresses (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 2 , 5 )
58- except Exception as e :
59- assert 'Specified object does not exist.' in str (e )
60-
47+ with pytest .raises (WebFault , match = 'Specified object does not exist.' ):
48+ ResultTables .SurfacesBasicStresses (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 2 , 5 )
6149 assert ResultTables .SurfacesBasicStresses (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 2 , 4 )
6250 assert ResultTables .SurfacesBasicTotalStrains (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 2 , 1 )
6351 assert ResultTables .SurfacesDesignInternalForces (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 2 , 2 )
@@ -72,7 +60,7 @@ def test_result_tables():
7260 assert ResultTables .SurfacesEquivalentTotalStrainsMises (CaseObjectType .E_OBJECT_TYPE_RESULT_COMBINATION , 1 , 1 )
7361 assert ResultTables .SurfacesEquivalentTotalStrainsRankine (CaseObjectType .E_OBJECT_TYPE_RESULT_COMBINATION , 1 , 2 )
7462
75- # DS1
63+ #DS1
7664 assert ResultTables .SurfacesEquivalentTotalStrainsTresca (CaseObjectType .E_OBJECT_TYPE_DESIGN_SITUATION , 1 , 3 )
7765 assert ResultTables .SurfacesGlobalDeformations (CaseObjectType .E_OBJECT_TYPE_DESIGN_SITUATION , 1 , 4 )
7866 assert ResultTables .SurfacesLocalDeformations (CaseObjectType .E_OBJECT_TYPE_DESIGN_SITUATION , 1 , 1 )
@@ -81,7 +69,7 @@ def test_result_tables():
8169 assert ResultTables .SurfacesPrincipalStresses (CaseObjectType .E_OBJECT_TYPE_DESIGN_SITUATION , 1 , 4 )
8270 assert ResultTables .SurfacesPrincipalTotalStrains (CaseObjectType .E_OBJECT_TYPE_DESIGN_SITUATION , 1 , 1 )
8371
84-
72+ #Object selection all versus specific
8573 table1 = ResultTables .MembersGlobalDeformations (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 1 , object_no = 0 )
8674 table2 = ResultTables .MembersGlobalDeformations (CaseObjectType .E_OBJECT_TYPE_LOAD_CASE , 1 , object_no = 3 )
8775 assert table1 [32 ] == table2 [0 ]
0 commit comments