Kaydet (Commit) 10fe4555 authored tarafından Collin Winter's avatar Collin Winter

Make test_softspace use unittest.

üst 82c36715
from test import test_support from test.test_support import run_unittest
import unittest
import StringIO import StringIO
# SF bug 480215: softspace confused in nested print class SoftspaceTests(unittest.TestCase):
f = StringIO.StringIO() def test_bug_480215(self):
class C: # SF bug 480215: softspace confused in nested print
def __str__(self): f = StringIO.StringIO()
print >> f, 'a' class C:
return 'b' def __str__(self):
print >> f, 'a'
return 'b'
print >> f, C(), 'c ', 'd\t', 'e' print >> f, C(), 'c ', 'd\t', 'e'
print >> f, 'f', 'g' print >> f, 'f', 'g'
# In 2.2 & earlier, this printed ' a\nbc d\te\nf g\n' # In 2.2 & earlier, this printed ' a\nbc d\te\nf g\n'
test_support.vereq(f.getvalue(), 'a\nb c d\te\nf g\n') self.assertEqual(f.getvalue(), 'a\nb c d\te\nf g\n')
def test_main():
run_unittest(SoftspaceTests)
if __name__ == '__main__':
test_main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment