Whitespace normalization.

This commit is contained in:
Tim Peters 2002-05-23 15:15:30 +00:00
parent f655328483
commit 8ac1495a6a
20 changed files with 100 additions and 101 deletions

View file

@ -177,13 +177,13 @@ def run_method_tests(test):
# strip/lstrip/rstrip with unicode arg
if have_unicode:
test('strip', 'xyzzyhelloxyzzy',
test('strip', 'xyzzyhelloxyzzy',
unicode('hello', 'ascii'), unicode('xyz', 'ascii'))
test('lstrip', 'xyzzyhelloxyzzy',
test('lstrip', 'xyzzyhelloxyzzy',
unicode('helloxyzzy', 'ascii'), unicode('xyz', 'ascii'))
test('rstrip', 'xyzzyhelloxyzzy',
unicode('xyzzyhello', 'ascii'), unicode('xyz', 'ascii'))
test('strip', 'hello',
test('strip', 'hello',
unicode('hello', 'ascii'), unicode('xyz', 'ascii'))
test('swapcase', 'HeLLo cOmpUteRs', 'hEllO CoMPuTErS')

View file

@ -6,20 +6,20 @@ from binascii import Error as binascii_error
class Base64TestCase(unittest.TestCase):
def test_encode_string(self):
"""Testing encode string"""
test_support.verify(base64.encodestring("www.python.org") ==
"d3d3LnB5dGhvbi5vcmc=\n",
test_support.verify(base64.encodestring("www.python.org") ==
"d3d3LnB5dGhvbi5vcmc=\n",
reason="www.python.org encodestring failed")
test_support.verify(base64.encodestring("a") ==
"YQ==\n",
test_support.verify(base64.encodestring("a") ==
"YQ==\n",
reason="a encodestring failed")
test_support.verify(base64.encodestring("ab") ==
"YWI=\n",
test_support.verify(base64.encodestring("ab") ==
"YWI=\n",
reason="ab encodestring failed")
test_support.verify(base64.encodestring("abc") ==
"YWJj\n",
test_support.verify(base64.encodestring("abc") ==
"YWJj\n",
reason="abc encodestring failed")
test_support.verify(base64.encodestring("") ==
"",
test_support.verify(base64.encodestring("") ==
"",
reason="null encodestring failed")
test_support.verify(base64.encodestring(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}") ==
@ -29,16 +29,16 @@ class Base64TestCase(unittest.TestCase):
def test_decode_string(self):
"""Testing decode string"""
test_support.verify(base64.decodestring("d3d3LnB5dGhvbi5vcmc=\n") ==
"www.python.org",
"www.python.org",
reason="www.python.org decodestring failed")
test_support.verify(base64.decodestring("YQ==\n") ==
"a",
"a",
reason="a decodestring failed")
test_support.verify(base64.decodestring("YWI=\n") ==
"ab",
"ab",
reason="ab decodestring failed")
test_support.verify(base64.decodestring("YWJj\n") ==
"abc",
"abc",
reason="abc decodestring failed")
test_support.verify(base64.decodestring(
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNTY3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n") ==
@ -50,10 +50,9 @@ class Base64TestCase(unittest.TestCase):
pass
else:
self.fail("expected a binascii.Error on null decode request")
def test_main():
test_support.run_unittest(Base64TestCase)
if __name__ == "__main__":
test_main()

View file

@ -113,7 +113,7 @@ else:
# Verify the treatment of Unicode strings
if have_unicode:
verify(binascii.hexlify(unicode('a', 'ascii')) == '61',
verify(binascii.hexlify(unicode('a', 'ascii')) == '61',
"hexlify failed for Unicode")
# A test for SF bug 534347 (segfaults without the proper fix)

View file

@ -104,7 +104,7 @@ class TestIsSubclassExceptions(unittest.TestCase):
__bases__ = property(getbases)
class S(C): pass
self.assertRaises(TypeError, issubclass, C(), S())
# Like above, but test the second branch, where the __bases__ of the
@ -176,7 +176,7 @@ class TestIsInstanceIsSubclass(unittest.TestCase):
# combinations.
def test_isinstance_normal(self):
# normal instances
# normal instances
self.assertEqual(True, isinstance(Super(), Super))
self.assertEqual(False, isinstance(Super(), Child))
self.assertEqual(False, isinstance(Super(), AbstractSuper))
@ -186,7 +186,7 @@ class TestIsInstanceIsSubclass(unittest.TestCase):
self.assertEqual(False, isinstance(Child(), AbstractSuper))
def test_isinstance_abstract(self):
# abstract instances
# abstract instances
self.assertEqual(True, isinstance(AbstractSuper(), AbstractSuper))
self.assertEqual(False, isinstance(AbstractSuper(), AbstractChild))
self.assertEqual(False, isinstance(AbstractSuper(), Super))
@ -196,7 +196,7 @@ class TestIsInstanceIsSubclass(unittest.TestCase):
self.assertEqual(True, isinstance(AbstractChild(), AbstractSuper))
self.assertEqual(False, isinstance(AbstractChild(), Super))
self.assertEqual(False, isinstance(AbstractChild(), Child))
def test_subclass_normal(self):
# normal classes
self.assertEqual(True, issubclass(Super, Super))
@ -217,7 +217,7 @@ class TestIsInstanceIsSubclass(unittest.TestCase):
self.assertEqual(True, issubclass(AbstractChild, AbstractSuper))
self.assertEqual(False, issubclass(AbstractChild, Super))
self.assertEqual(False, issubclass(AbstractChild, Child))

View file

@ -137,7 +137,7 @@ testit('pow(2,-1)', math.pow(2,-1), 0.5)
print 'radians'
testit('radians(180)', math.radians(180), math.pi)
testit('radians(90)', math.radians(90), math.pi/2)
testit('radians(-45)', math.radians(-45), -math.pi/4)
testit('radians(-45)', math.radians(-45), -math.pi/4)
print 'sin'
testit('sin(0)', math.sin(0), 0)

View file

@ -38,7 +38,7 @@ def test(name, input, output, *args):
value = apply(f, (input,) + args)
if value is input:
if verbose:
print 'no'
print 'no'
print '*',f, `input`, `output`, `value`
return
if value != output:

View file

@ -68,7 +68,7 @@ def test(method, input, output, *args):
exc = sys.exc_info()[:2]
if value is input:
if verbose:
print 'no'
print 'no'
print '*',f, `input`, `output`, `value`
return
if value != output or type(value) is not type(output):