Merge branch 'vadz-better-param-names'

* vadz-better-param-names:
  Enable keyword arguments for keyword_rename unit test
  Update error messages test suite
  Add more tests for Python parameter renaming
  Improve handling parameters clashing with language keywords
This commit is contained in:
William S Fulton 2019-01-17 18:19:36 +00:00
commit 2e9b270cbb
7 changed files with 25 additions and 18 deletions

View file

@ -148,3 +148,11 @@ bool is_python_builtin() { return true; }
bool is_python_builtin() { return false; }
#endif
%}
// Autodoc Python keywords
%warnfilter(SWIGWARN_PARSE_KEYWORD) process;
%feature(autodoc,0) process;
%feature("compactdefaultargs") process;
%inline %{
int process(int from) { return from; }
%}

View file

@ -3,5 +3,7 @@ swig_typemap_warn.i:7: Warning 1000: Test warning for 'in' typemap for int arg3
swig_typemap_warn.i:7: Warning 1001: Test warning for 'out' typemap for double mmm (result) - name: mmm symname: mmm &1_ltype: double * descriptor: SWIGTYPE_double
swig_typemap_warn.i:7: Warning 1000: Test warning for 'in' typemap for int abc (arg1) - argnum: 1 &1_ltype: int * descriptor: SWIGTYPE_int
swig_typemap_warn.i:7: Warning 1000: Test warning for 'in' typemap for int arg3 (arg3) - argnum: 3 &1_ltype: int * descriptor: SWIGTYPE_int
swig_typemap_warn.i:7: Warning 314: 'def' is a python keyword, renaming to '_def'
swig_typemap_warn.i:7: Warning 1000: Test warning for 'in' typemap for int abc (arg1) - argnum: 1 &1_ltype: int * descriptor: SWIGTYPE_int
swig_typemap_warn.i:7: Warning 1000: Test warning for 'in' typemap for int arg3 (arg3) - argnum: 3 &1_ltype: int * descriptor: SWIGTYPE_int
swig_typemap_warn.i:7: Warning 314: 'def' is a python keyword, renaming to '_def'

View file

@ -4,6 +4,8 @@
%module keyword_rename
%feature("kwargs");
#pragma SWIG nowarn=SWIGWARN_PARSE_KEYWORD
%inline %{

View file

@ -202,3 +202,5 @@ check(inspect.getdoc(banana), "banana(S a, S b, int c, Integer d)")
check(inspect.getdoc(TInteger), "Proxy of C++ T< int > class.", "::T< int >")
check(inspect.getdoc(TInteger.__init__), "__init__(TInteger self) -> TInteger", None, skip)
check(inspect.getdoc(TInteger.inout), "inout(TInteger self, TInteger t) -> TInteger")
check(inspect.getdoc(process), "process(_from) -> int")

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
import keyword_rename
keyword_rename._in(1)
keyword_rename._in(_except=1)
keyword_rename._except(1)
keyword_rename._except(_in=1)