def test_parser_createinvokecall_error(): '''Test that if an argument to an invoke call is not what is expected then the appropriate exception is raised. ''' statement = Call_Stmt("call invoke(0.0)") tmp = Parser() with pytest.raises(ParseError) as excinfo: _ = tmp.create_invoke_call(statement) assert ("Expecting argument to be of the form 'name=xxx' or a Kernel call " "but found '0.0' in file 'None'.") in str(excinfo.value)
def test_parser_createinvokecall(): '''Test that valid invoke calls are created without an exception. Limit this to builtins as kernel calls fail as there is no associated use statement declared. Test with names, real scalars, integer scalars and structure references, including ones to self, as the parser represents these in different ways so the create_invoke_call needs to deal with the different representations. ''' statement = Call_Stmt( "call invoke(name=\"dummy\", setval_c(a,1.0), setval_c(a,1), " "setval_c(a,b), setval_c(a%c, b), setval_c(self%a, 1.0), " "setval_c(self%a, b))") parse = Parser() _ = parse.create_invoke_call(statement)