mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Merged revisions 86596 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line #9424: Replace deprecated assert* methods in the Python test suite. ........
This commit is contained in:
parent
40a92f5c65
commit
2623a37852
184 changed files with 2328 additions and 2326 deletions
|
@ -29,7 +29,7 @@ class BaseTestCase(unittest.TestCase):
|
|||
|
||||
|
||||
def check(self, result, expect):
|
||||
self.assertEquals(result, expect,
|
||||
self.assertEqual(result, expect,
|
||||
'expected:\n%s\nbut got:\n%s' % (
|
||||
self.show(expect), self.show(result)))
|
||||
|
||||
|
@ -39,9 +39,9 @@ class BaseTestCase(unittest.TestCase):
|
|||
|
||||
def check_split(self, text, expect):
|
||||
result = self.wrapper._split(text)
|
||||
self.assertEquals(result, expect,
|
||||
"\nexpected %r\n"
|
||||
"but got %r" % (expect, result))
|
||||
self.assertEqual(result, expect,
|
||||
"\nexpected %r\n"
|
||||
"but got %r" % (expect, result))
|
||||
|
||||
|
||||
class WrapTestCase(BaseTestCase):
|
||||
|
@ -504,7 +504,7 @@ class DedentTestCase(unittest.TestCase):
|
|||
|
||||
def assertUnchanged(self, text):
|
||||
"""assert that dedent() has no effect on 'text'"""
|
||||
self.assertEquals(text, dedent(text))
|
||||
self.assertEqual(text, dedent(text))
|
||||
|
||||
def test_dedent_nomargin(self):
|
||||
# No lines indented.
|
||||
|
@ -527,17 +527,17 @@ class DedentTestCase(unittest.TestCase):
|
|||
# All lines indented by two spaces.
|
||||
text = " Hello there.\n How are ya?\n Oh good."
|
||||
expect = "Hello there.\nHow are ya?\nOh good."
|
||||
self.assertEquals(expect, dedent(text))
|
||||
self.assertEqual(expect, dedent(text))
|
||||
|
||||
# Same, with blank lines.
|
||||
text = " Hello there.\n\n How are ya?\n Oh good.\n"
|
||||
expect = "Hello there.\n\nHow are ya?\nOh good.\n"
|
||||
self.assertEquals(expect, dedent(text))
|
||||
self.assertEqual(expect, dedent(text))
|
||||
|
||||
# Now indent one of the blank lines.
|
||||
text = " Hello there.\n \n How are ya?\n Oh good.\n"
|
||||
expect = "Hello there.\n\nHow are ya?\nOh good.\n"
|
||||
self.assertEquals(expect, dedent(text))
|
||||
self.assertEqual(expect, dedent(text))
|
||||
|
||||
def test_dedent_uneven(self):
|
||||
# Lines indented unevenly.
|
||||
|
@ -551,27 +551,27 @@ def foo():
|
|||
while 1:
|
||||
return foo
|
||||
'''
|
||||
self.assertEquals(expect, dedent(text))
|
||||
self.assertEqual(expect, dedent(text))
|
||||
|
||||
# Uneven indentation with a blank line.
|
||||
text = " Foo\n Bar\n\n Baz\n"
|
||||
expect = "Foo\n Bar\n\n Baz\n"
|
||||
self.assertEquals(expect, dedent(text))
|
||||
self.assertEqual(expect, dedent(text))
|
||||
|
||||
# Uneven indentation with a whitespace-only line.
|
||||
text = " Foo\n Bar\n \n Baz\n"
|
||||
expect = "Foo\n Bar\n\n Baz\n"
|
||||
self.assertEquals(expect, dedent(text))
|
||||
self.assertEqual(expect, dedent(text))
|
||||
|
||||
# dedent() should not mangle internal tabs
|
||||
def test_dedent_preserve_internal_tabs(self):
|
||||
text = " hello\tthere\n how are\tyou?"
|
||||
expect = "hello\tthere\nhow are\tyou?"
|
||||
self.assertEquals(expect, dedent(text))
|
||||
self.assertEqual(expect, dedent(text))
|
||||
|
||||
# make sure that it preserves tabs when it's not making any
|
||||
# changes at all
|
||||
self.assertEquals(expect, dedent(expect))
|
||||
self.assertEqual(expect, dedent(expect))
|
||||
|
||||
# dedent() should not mangle tabs in the margin (i.e.
|
||||
# tabs and spaces both count as margin, but are *not*
|
||||
|
@ -587,17 +587,17 @@ def foo():
|
|||
# dedent() only removes whitespace that can be uniformly removed!
|
||||
text = "\thello there\n\thow are you?"
|
||||
expect = "hello there\nhow are you?"
|
||||
self.assertEquals(expect, dedent(text))
|
||||
self.assertEqual(expect, dedent(text))
|
||||
|
||||
text = " \thello there\n \thow are you?"
|
||||
self.assertEquals(expect, dedent(text))
|
||||
self.assertEqual(expect, dedent(text))
|
||||
|
||||
text = " \t hello there\n \t how are you?"
|
||||
self.assertEquals(expect, dedent(text))
|
||||
self.assertEqual(expect, dedent(text))
|
||||
|
||||
text = " \thello there\n \t how are you?"
|
||||
expect = "hello there\n how are you?"
|
||||
self.assertEquals(expect, dedent(text))
|
||||
self.assertEqual(expect, dedent(text))
|
||||
|
||||
|
||||
def test_main():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue