[Python-checkins] python/dist/src/Lib/test string_tests.py,1.22,1.23 test_string.py,1.19,1.20 test_userstring.py,1.8,1.9
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Thu, 08 Aug 2002 18:37:08 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv31329/test
Modified Files:
string_tests.py test_string.py test_userstring.py
Log Message:
Moved inplace add and multiply methods from UserString to MutableString.
Closes SF Bug #592573 where inplace add mutated a UserString.
Added unittests to verify the bug is cleared.
Index: string_tests.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** string_tests.py 9 Aug 2002 00:43:38 -0000 1.22
--- string_tests.py 9 Aug 2002 01:37:06 -0000 1.23
***************
*** 315,316 ****
--- 315,322 ----
test('__contains__', 'asd', False, 'asdf') # vereq('asdf' in 'asd', False)
test('__contains__', '', False, 'asdf') # vereq('asdf' in '', False)
+
+ def run_inplace_tests(constructor):
+ # Verify clearing of SF bug #592573
+ s = t = constructor('abc')
+ s += constructor('def')
+ verify(s != t, 'in-place concatenate should create a new object')
Index: test_string.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_string.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** test_string.py 6 Aug 2002 16:58:20 -0000 1.19
--- test_string.py 9 Aug 2002 01:37:06 -0000 1.20
***************
*** 53,56 ****
--- 53,57 ----
string_tests.run_method_tests(test)
string_tests.run_contains_tests(test)
+ string_tests.run_inplace_tests(str)
string.whitespace
Index: test_userstring.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userstring.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** test_userstring.py 6 Aug 2002 16:58:20 -0000 1.8
--- test_userstring.py 9 Aug 2002 01:37:06 -0000 1.9
***************
*** 43,44 ****
--- 43,45 ----
string_tests.run_method_tests(test)
string_tests.run_contains_tests(test)
+ string_tests.run_inplace_tests(UserString)