@@ -157,7 +157,11 @@ public void checkSyntaxErrorMessageContains(String source, String expectedMessag
157
157
parse (source , name .getMethodName (), PythonParser .ParserMode .File );
158
158
} catch (PException e ) {
159
159
thrown = isSyntaxError (e );
160
- Assert .assertTrue ("The expected message:\n \" " + expectedMessage + "\" \n was not found in\n \" " + e .getMessage () + "\" " , e .getMessage ().contains (expectedMessage ));
160
+ InteropLibrary interop = InteropLibrary .getUncached ();
161
+ Object exceptionMessageObject = interop .getExceptionMessage (e );
162
+ Assert .assertTrue (interop .isString (exceptionMessageObject ));
163
+ String exceptionMessage = interop .asString (exceptionMessageObject );
164
+ Assert .assertTrue ("The expected message:\n \" " + expectedMessage + "\" \n was not found in\n \" " + exceptionMessage + "\" " , exceptionMessage .contains (expectedMessage ));
161
165
}
162
166
163
167
assertTrue ("Expected SyntaxError was not thrown." , thrown );
@@ -169,7 +173,10 @@ public void checkSyntaxErrorMessage(String source, String expectedMessage) throw
169
173
parse (source , name .getMethodName (), PythonParser .ParserMode .File );
170
174
} catch (PException e ) {
171
175
thrown = isSyntaxError (e );
172
- Assert .assertEquals (expectedMessage , e .getMessage ());
176
+ InteropLibrary interop = InteropLibrary .getUncached ();
177
+ Object exceptionMessage = interop .getExceptionMessage (e );
178
+ Assert .assertTrue (interop .isString (exceptionMessage ));
179
+ Assert .assertEquals (expectedMessage , interop .asString (exceptionMessage ));
173
180
}
174
181
175
182
assertTrue ("Expected SyntaxError was not thrown." , thrown );
0 commit comments