Bypass Python tests failing with -builtin

Reverse operators not supported in builtin types
This commit is contained in:
William S Fulton 2014-10-02 20:18:38 +01:00
commit 9f1b051c16
5 changed files with 25 additions and 15 deletions

View file

@ -49,6 +49,12 @@ std::basic_string<char,std::char_traits<char>,std::allocator<char> > test_value_
return x;
}
#ifdef SWIGPYTHON_BUILTIN
bool is_python_builtin() { return true; }
#else
bool is_python_builtin() { return false; }
#endif
%}
%include "li_std_string.i"

View file

@ -92,6 +92,12 @@ void test_throw() throw(std::wstring){
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#ifdef SWIGPYTHON_BUILTIN
bool is_python_builtin() { return true; }
#else
bool is_python_builtin() { return false; }
#endif
%}

View file

@ -90,8 +90,6 @@ BUILTIN_BROKEN = \
autodoc.cpptest \
default_constructor.cpptest \
import_nomodule.cpptest \
li_std_string_extra.cpptest \
li_std_wstring.cpptest \
python_abstractbase.cpptest \
BUILTIN_NOT_BROKEN = $(filter-out $(BUILTIN_BROKEN),$(NOT_BROKEN_TEST_CASES))

View file

@ -56,14 +56,13 @@ if a + " world" != "hello world":
# This is expected to fail with -builtin option
# Reverse operators not supported in builtin types
if "hello" + b != "hello world":
raise RuntimeError, "bad string mapping"
if not li_std_string_extra.is_python_builtin():
if "hello" + b != "hello world":
raise RuntimeError, "bad string mapping"
# This is expected to fail with -builtin option
# Reverse operators not supported in builtin types
c = "hello" + b
if c.find_last_of("l") != 9:
raise RuntimeError, "bad string mapping"
c = "hello" + b
if c.find_last_of("l") != 9:
raise RuntimeError, "bad string mapping"
s = "hello world"

View file

@ -60,13 +60,14 @@ if a + " world" != "hello world":
raise RuntimeError("bad string mapping")
# This is expected to fail if -builtin is used
if "hello" + b != "hello world":
raise RuntimeError("bad string mapping")
# Reverse operators not supported in builtin types
if not li_std_wstring.is_python_builtin():
if "hello" + b != "hello world":
raise RuntimeError("bad string mapping")
# This is expected to fail if -builtin is used
c = "hello" + b
if c.find_last_of("l") != 9:
raise RuntimeError("bad string mapping")
c = "hello" + b
if c.find_last_of("l") != 9:
raise RuntimeError("bad string mapping")
s = "hello world"