2222
2323import pytest
2424import sys
25-
26- from ansys import dpf
25+ import ansys .dpf .core as dpf
2726from ansys .dpf .core import errors , operators as ops
2827
2928def test_server_exception_from_operator ():
30- ds = dpf .core . DataSources (r"dummy/file.rst" )
29+ ds = dpf .DataSources (r"dummy/file.rst" )
3130 op = ops .result .displacement (data_sources = ds )
3231 with pytest .raises (errors .DPFServerException ) as exception_note :
3332 op .eval ()
34-
35- assert hasattr (exception_note , '__notes__' ), "The exception does not contain any note"
36- assert exception_note .__notes__
33+
34+ exception = exception_note .value
35+ assert hasattr (exception , '__notes__' ), "The exception does not contain any note"
36+ assert exception .__notes__
3737
3838def test_server_exception_from_workflow ():
39- disp = ops .result .displacement ()
40- workflow = dpf .Workflow ()
41-
42- workflow .add_operator (disp )
43- workflow .set_output_name ("displacement" , disp .outputs .fields_container )
44- workflow .eval ()
39+ op = dpf .operators .result .displacement (data_sources = dpf .DataSources ("toto.rst" ))
40+
41+ wf = dpf .Workflow ()
42+ wf .add_operator (op )
43+ wf .set_output_name ("out" , op .outputs .fields_container )
44+
45+ with pytest .raises (errors .DPFServerException ) as exception_note :
46+ wf .get_output ("out" , output_type = dpf .FieldsContainer )
47+
48+ print (type (exception_note ))
49+ exception = exception_note .value
50+ assert hasattr (exception , '__notes__' ), "The exception does not contain any note"
51+ assert exception .__notes__
4552
0 commit comments