From 00c8d50988e39c8a737b56b488c92eba8666595b Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Wed, 11 Jan 2006 23:06:15 +0000 Subject: [PATCH] change runtime examples to run with old python versions git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8376 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../Examples/test-suite/python/director_basic_runme.py | 4 ++-- SWIG/Examples/test-suite/python/li_std_carray_runme.py | 6 +++--- SWIG/Examples/test-suite/python/li_std_set_runme.py | 10 +++++----- SWIG/Examples/test-suite/python/li_std_stream_runme.py | 6 +++--- SWIG/Examples/test-suite/python/li_std_string_runme.py | 2 +- .../Examples/test-suite/python/li_std_wstream_runme.py | 8 ++++---- .../Examples/test-suite/python/li_std_wstring_runme.py | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/SWIG/Examples/test-suite/python/director_basic_runme.py b/SWIG/Examples/test-suite/python/director_basic_runme.py index c066ccc66..541139814 100644 --- a/SWIG/Examples/test-suite/python/director_basic_runme.py +++ b/SWIG/Examples/test-suite/python/director_basic_runme.py @@ -34,7 +34,7 @@ class PyClass(director_basic.MyClass): pass def vmethod(self, b): - b.x += 31 + b.x = b.x + 31 return b @@ -69,7 +69,7 @@ class PyMulti(director_basic.Foo, director_basic.MyClass): def vmethod(self, b): - b.x += 31 + b.x = b.x + 31 return b diff --git a/SWIG/Examples/test-suite/python/li_std_carray_runme.py b/SWIG/Examples/test-suite/python/li_std_carray_runme.py index 2d8627af2..803bc96c5 100644 --- a/SWIG/Examples/test-suite/python/li_std_carray_runme.py +++ b/SWIG/Examples/test-suite/python/li_std_carray_runme.py @@ -9,7 +9,7 @@ i = 0 for d in v3: if d != i: raise RuntimeError - i += 1 + i = i + 1 m3 = Matrix3() @@ -25,9 +25,9 @@ for v3 in m3: for d in v3: if d != i + j: raise RuntimeError - j += 1 + j = j + 1 pass - i += 1 + i = i + 1 pass for i in range(0,len(m3)): diff --git a/SWIG/Examples/test-suite/python/li_std_set_runme.py b/SWIG/Examples/test-suite/python/li_std_set_runme.py index 50471ea13..6d8963138 100644 --- a/SWIG/Examples/test-suite/python/li_std_set_runme.py +++ b/SWIG/Examples/test-suite/python/li_std_set_runme.py @@ -8,7 +8,7 @@ s.append("c") sum = "" for i in s: - sum += i + sum = sum + i if sum != "abc": raise RuntimeError @@ -26,7 +26,7 @@ b = s.begin() e = s.end() sum = "" while (b != e): - sum += b.next() + sum = sum + b.next() if sum != "abc": raise RuntimeError @@ -34,7 +34,7 @@ b = s.rbegin() e = s.rend() sum = "" while (b != e): - sum += b.next() + sum = sum + b.next() if sum != "cba": raise RuntimeError @@ -66,7 +66,7 @@ b = s.begin() e = s.end() sum = "" while (b != e): - sum += b.next() + sum = sum + b.next() if sum != "ac": raise RuntimeError @@ -90,7 +90,7 @@ s.insert("hello") sum = () for i in s: - sum += (i,) + sum = sum + (i,) if sum != (1, 'hello', (1, 2)): raise RuntimeError diff --git a/SWIG/Examples/test-suite/python/li_std_stream_runme.py b/SWIG/Examples/test-suite/python/li_std_stream_runme.py index b03bda9cb..d41e41f4a 100644 --- a/SWIG/Examples/test-suite/python/li_std_stream_runme.py +++ b/SWIG/Examples/test-suite/python/li_std_stream_runme.py @@ -1,10 +1,10 @@ -import li_std_stream as std +from li_std_stream import * -a = std.A() +a = A() -o = std.ostringstream() +o = ostringstream() o << a << " " << 2345 << " " << 1.435 diff --git a/SWIG/Examples/test-suite/python/li_std_string_runme.py b/SWIG/Examples/test-suite/python/li_std_string_runme.py index 7a04a3e6f..8f136e782 100644 --- a/SWIG/Examples/test-suite/python/li_std_string_runme.py +++ b/SWIG/Examples/test-suite/python/li_std_string_runme.py @@ -21,7 +21,7 @@ if li_std_string.test_const_reference(x) != x: s = li_std_string.string("he") #s += "ll" #s.append('o') -s += "llo" +s = s + "llo" if s != x: print s, x diff --git a/SWIG/Examples/test-suite/python/li_std_wstream_runme.py b/SWIG/Examples/test-suite/python/li_std_wstream_runme.py index 69a1a63e4..f7379bdf8 100644 --- a/SWIG/Examples/test-suite/python/li_std_wstream_runme.py +++ b/SWIG/Examples/test-suite/python/li_std_wstream_runme.py @@ -1,12 +1,12 @@ -import li_std_wstream as std +from li_std_wstream import * -a = std.A() +a = A() -o = std.wostringstream() +o = wostringstream() -o << a << u" " << 2345 << u" " << 1.435 << std.wends +o << a << u" " << 2345 << u" " << 1.435 << wends if o.str() != "A class 2345 1.435\0": print "\"%s\"" % (o.str(),) diff --git a/SWIG/Examples/test-suite/python/li_std_wstring_runme.py b/SWIG/Examples/test-suite/python/li_std_wstring_runme.py index 1b2252ddb..a4b9d3ee2 100644 --- a/SWIG/Examples/test-suite/python/li_std_wstring_runme.py +++ b/SWIG/Examples/test-suite/python/li_std_wstring_runme.py @@ -22,7 +22,7 @@ if li_std_wstring.test_const_reference(x) != x: s = li_std_wstring.wstring(u"he") -s += u"llo" +s = s + u"llo" if s != x: print s, x