diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2001-02-09 11:51:27 (GMT) |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2001-02-09 11:51:27 (GMT) |
commit | fc170b1fd5db978f4e8d4c23c138a7b59df681ec (patch) | |
tree | 3c73ffcba8f5ece8c64a086a362b7fbe65368048 /Lib/test | |
parent | d8c628bd59f70b5389c39fd9e6a15cb3e2d46f27 (diff) | |
download | cpython-fc170b1fd5db978f4e8d4c23c138a7b59df681ec.zip cpython-fc170b1fd5db978f4e8d4c23c138a7b59df681ec.tar.gz cpython-fc170b1fd5db978f4e8d4c23c138a7b59df681ec.tar.bz2 |
String method conversion.
Diffstat (limited to 'Lib/test')
-rwxr-xr-x | Lib/test/regrtest.py | 7 | ||||
-rw-r--r-- | Lib/test/sortperf.py | 5 | ||||
-rw-r--r-- | Lib/test/string_tests.py | 4 | ||||
-rw-r--r-- | Lib/test/test_dospath.py | 3 | ||||
-rw-r--r-- | Lib/test/test_extcall.py | 3 | ||||
-rwxr-xr-x | Lib/test/test_imgfile.py | 5 | ||||
-rw-r--r-- | Lib/test/test_mmap.py | 6 | ||||
-rw-r--r-- | Lib/test/test_ntpath.py | 3 | ||||
-rw-r--r-- | Lib/test/test_pkg.py | 4 |
9 files changed, 17 insertions, 23 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 60bc6c6..5866d43 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -32,7 +32,6 @@ of /tmp). """ import sys -import string import os import getopt import traceback @@ -106,7 +105,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0, filename = os.path.join(gettempdir(), 'pynexttest') try: fp = open(filename, 'r') - next = string.strip(fp.read()) + next = fp.read().strip() tests = [next] fp.close() except IOError: @@ -163,10 +162,10 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0, print "that passes in verbose mode may fail without it." if bad: print count(len(bad), "test"), "failed:", - print string.join(bad) + print " ".join(bad) if skipped and not quiet: print count(len(skipped), "test"), "skipped:", - print string.join(skipped) + print " ".join(skipped) if single: alltests = findtests(testdir, stdtests, nottests) diff --git a/Lib/test/sortperf.py b/Lib/test/sortperf.py index 34ed338..fd22194 100644 --- a/Lib/test/sortperf.py +++ b/Lib/test/sortperf.py @@ -112,16 +112,15 @@ def main(): Extra arguments are used to seed the random generator. """ - import string # default range (inclusive) k1 = 15 k2 = 19 if sys.argv[1:]: # one argument: single point - k1 = k2 = string.atoi(sys.argv[1]) + k1 = k2 = int(sys.argv[1]) if sys.argv[2:]: # two arguments: specify range - k2 = string.atoi(sys.argv[2]) + k2 = int(sys.argv[2]) if sys.argv[3:]: # derive random seed from remaining arguments x, y, z = 0, 0, 0 diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index 2e912c8..a408ef3 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -44,8 +44,8 @@ def run_module_tests(test): test('join', BadSeq2(), 'a b c') # try a few long ones - print string.join(['x' * 100] * 100, ':') - print string.join(('x' * 100,) * 100, ':') + print ":".join(['x' * 100] * 100) + print ":".join(('x' * 100,) * 100) def run_method_tests(test): diff --git a/Lib/test/test_dospath.py b/Lib/test/test_dospath.py index 08d32da..5b0fee5 100644 --- a/Lib/test/test_dospath.py +++ b/Lib/test/test_dospath.py @@ -1,11 +1,10 @@ import dospath -import string import os errors = 0 def tester(fn, wantResult): - fn = string.replace(fn, "\\", "\\\\") + fn = fn.replace("\\", "\\\\") gotResult = eval(fn) if wantResult != gotResult: print "error!" diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py index 10162aa..9e6da62 100644 --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -1,6 +1,5 @@ from test_support import verify, verbose, TestFailed from UserList import UserList -import string def sortdict(d): keys = d.keys() @@ -195,7 +194,7 @@ for args in ['', 'a', 'ab']: if vararg: arglist.append('*' + vararg) if kwarg: arglist.append('**' + kwarg) decl = 'def %s(%s): print "ok %s", a, b, d, e, v, k' % ( - name, string.join(arglist, ', '), name) + name, ', '.join(arglist), name) exec(decl) func = eval(name) funcs.append(func) diff --git a/Lib/test/test_imgfile.py b/Lib/test/test_imgfile.py index 8eb330d..26f6186 100755 --- a/Lib/test/test_imgfile.py +++ b/Lib/test/test_imgfile.py @@ -30,7 +30,6 @@ def testimage(name): import sys import os - import string outputfile = '/tmp/deleteme' @@ -47,9 +46,9 @@ def testimage(name): else: # ...or the full path of the module ourname = sys.modules[__name__].__file__ - parts = string.splitfields(ourname, os.sep) + parts = ourname.split(os.sep) parts[-1] = name - name = string.joinfields(parts, os.sep) + name = os.sep.joinfields(parts) sizes = imgfile.getsizes(name) if verbose: print 'Opening test image: %s, sizes: %s' % (name, str(sizes)) diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 4673913..8066285 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -1,6 +1,6 @@ from test_support import verify import mmap -import string, os, re, sys +import os, re, sys PAGESIZE = mmap.PAGESIZE @@ -21,8 +21,8 @@ def test_both(): # Simple sanity checks print type(m) # SF bug 128713: segfaulted on Linux - print ' Position of foo:', string.find(m, 'foo') / float(PAGESIZE), 'pages' - verify(string.find(m, 'foo') == PAGESIZE) + print ' Position of foo:', m.find('foo') / float(PAGESIZE), 'pages' + verify(m.find('foo') == PAGESIZE) print ' Length of file:', len(m) / float(PAGESIZE), 'pages' verify(len(m) == 2*PAGESIZE) diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py index 1b49c03..7867fd9 100644 --- a/Lib/test/test_ntpath.py +++ b/Lib/test/test_ntpath.py @@ -1,11 +1,10 @@ import ntpath -import string import os errors = 0 def tester(fn, wantResult): - fn = string.replace(fn, "\\", "\\\\") + fn = fn.replace("\\", "\\\\") gotResult = eval(fn) if wantResult != gotResult: print "error!" diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py index d915e10..f699af40 100644 --- a/Lib/test/test_pkg.py +++ b/Lib/test/test_pkg.py @@ -1,6 +1,6 @@ # Test packages (dotted-name import) -import sys, os, string, tempfile, traceback +import sys, os, tempfile, traceback from os import mkdir, rmdir # Can't test if these fail del mkdir, rmdir from test_support import verify, verbose, TestFailed @@ -10,7 +10,7 @@ from test_support import verify, verbose, TestFailed def mkhier(root, descr): mkdir(root) for name, contents in descr: - comps = string.split(name) + comps = name.split() fullname = root for c in comps: fullname = os.path.join(fullname, c) |