from test_support import * import string, sys print_test('string (test_string.py)', 1) names = {} def test(name, input, output, *args): if not names.has_key(name): print_test(name, 2) names[name] = 1 f = getattr(string, name) try: value = apply(f, (input,) + args) except: value = sys.exc_type if verbose and value <> output: print 'value=', value, ', output=', output assert value == output test('atoi', " 1 ", 1) test('atoi', " 1x", ValueError) test('atoi', " x1 ", ValueError) test('atol', " 1 ", 1L) test('atol', " 1x ", ValueError) test('atol', " x1 ", ValueError) test('atof', " 1 ", 1.0) #test('atof', " 1x ", ValueError) test('atof', " x1 ", ValueError) test('capitalize', ' hello ', ' hello ') test('capitalize', 'hello ', 'Hello ') test('find', 'abcdefghiabc', 0, 'abc') test('find', 'abcdefghiabc', 9, 'abc', 1) test('find', 'abcdefghiabc', -1, 'def', 4) test('rfind', 'abcdefghiabc', 9, 'abc') test('lower', 'HeLLo', 'hello') test('upper', 'HeLLo', 'HELLO') test('split', 'this is the split function', ['this', 'is', 'the', 'split', 'function']) test('split', 'a|b|c|d', ['a', 'b', 'c', 'd'], '|') test('split', 'a|b|c|d', ['a', 'b', 'c|d'], '|', 2) test('split', 'a b c d', ['a', 'b c d'], None, 1) test('split', 'a b c d', ['a', 'b', 'c d'], None, 2) test('split', 'a b c d', ['a', 'b', 'c', 'd'], None, 3) test('split', 'a b c d', ['a', 'b', 'c', 'd'], None, 4) test('split', 'a b c d', ['a b c d'], None, 0) test('split', 'a b c d', ['a', 'b', 'c', 'd'], None, -1) test('split', 'a b c d', ['a', 'b', 'c d'], None, 2) # join now works with any sequence type class Sequence: def __init__(self): self.seq = 'wxyz' def __len__(self): return len(self.seq) def __getitem__(self, i): return self.seq[i] test('join', ['a', 'b', 'c', 'd'], 'a b c d') test('join', ('a', 'b', 'c', 'd'), 'abcd', '') test('join', Sequence(), 'w x y z') # try a few long ones longstring = "\ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\ xxxxxxxxxxxxxxxxx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xxxxxxxxxxxx" assert string.join(['x' * 100] * 100, ':') == longstring assert string.join(('x' * 100,) * 100, ':') == longstring test('strip', ' hello ', 'hello') test('lstrip', ' hello ', 'hello ') test('rstrip', ' hello ', ' hello') test('swapcase', 'HeLLo cOmpUteRs', 'hEllO CoMPuTErS') test('replace', 'one!two!three!', 'one@two!three!', '!', '@', 1) test('replace', 'one!two!three!', 'one@two@three!', '!', '@', 2) test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 3) test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 4) test('replace', 'one!two!three!', 'one!two!three!', '!', '@', 0) test('replace', 'one!two!three!', 'one@two@three@', '!', '@', -1) test('replace', 'one!two!three!', 'one@two@three@', '!', '@') test('replace', 'one!two!three!', 'one!two!three!', 'x', '@') test('replace', 'one!two!three!', 'one!two!three!', 'x', '@', 2) test('count', 'aaa', 3, 'a') test('count', 'aaa', 2, 'a', 0, 2) test('count', 'ababab', 3, 'ab', 0) test('count', 'ababab', 2, 'ab', 0, 5) test('count', 'ababab', 2, 'ab', 1) test('count', 'ababab', 2, 'ab', 1, 6) test('count', 'ababab', 0, 'abc') test('count', 'ababab', 7, '') string.whitespace string.lowercase string.uppercase