Tests for Python default arguments and %pythondefaultargs.

Tests changes in previous commit (see patch #294)
This commit is contained in:
William S Fulton 2015-01-11 16:45:53 +00:00
commit 679f9395bc
2 changed files with 5 additions and 7 deletions

View file

@ -13,11 +13,14 @@
%inline %{ %inline %{
#include <string> #include <string>
// All kinds of numbers: hex, octal (which pose special problems to Python), negative... // All kinds of numbers: hex, octal (which pose special problems to Python (using %pythondefaultargs), negative...
void trickyvalue1(int first, int pos = -1) {} void trickyvalue1(int first, int pos = -1) {}
void trickyvalue2(int first, unsigned rgb = 0xabcdef) {} void trickyvalue2(int first, unsigned rgb = 0xabcdef) {}
void trickyvalue3(int first, int mode = 0644) {} void trickyvalue3(int first, int mode = 0644) {}
void doublevalue1(int first, double num = 0.0e-1) {}
void doublevalue2(int first, double num = -0.0E2) {}
// Long long arguments are not handled at Python level currently but still work. // Long long arguments are not handled at Python level currently but still work.
void seek(long long offset = 0LL) {} void seek(long long offset = 0LL) {}

View file

@ -1,11 +1,6 @@
%module python_default_args %module python_default_args
// Testing use of %pythondefaultargs
%pythondefaultargs; %pythondefaultargs;
// Turn off the feature for the tricky cases that can't be handled
%nopythondefaultargs trickyvalue3; // 'mode=0644' is okay in Python 2, but no Python 3
%nopythondefaultargs seek;
%nopythondefaultargs Space::Klass::inc;
%nopythondefaultargs DerivedEnumClass::accelerate;
%include "default_args.i" %include "default_args.i"