annotate Lib/test/test_softspace.py @ 79675:c0a2294de787 2.7

Issue #16199: Backport 2to3 typo fix from 3.2.
author Chris Jerdonek <chris.jerdonek@gmail.com>
date Thu, 11 Oct 2012 16:15:46 -0700
parents 4b9fa8092e82
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41384
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
1 from test.test_support import run_unittest
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
2 import unittest
22499
3a3de6567f1a SF bug 480215: softspace confused in nested print
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
3 import StringIO
3a3de6567f1a SF bug 480215: softspace confused in nested print
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
4
41384
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
5 class SoftspaceTests(unittest.TestCase):
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
6 def test_bug_480215(self):
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
7 # SF bug 480215: softspace confused in nested print
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
8 f = StringIO.StringIO()
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
9 class C:
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
10 def __str__(self):
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
11 print >> f, 'a'
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
12 return 'b'
22499
3a3de6567f1a SF bug 480215: softspace confused in nested print
Tim Peters <tim.peters@gmail.com>
parents:
diff changeset
13
41384
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
14 print >> f, C(), 'c ', 'd\t', 'e'
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
15 print >> f, 'f', 'g'
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
16 # In 2.2 & earlier, this printed ' a\nbc d\te\nf g\n'
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
17 self.assertEqual(f.getvalue(), 'a\nb c d\te\nf g\n')
41532
4b9fa8092e82 Whitespace normalization. Ugh, we really need to do this more often.
Neal Norwitz <nnorwitz@gmail.com>
parents: 41384
diff changeset
18
41384
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
19 def test_main():
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
20 run_unittest(SoftspaceTests)
41532
4b9fa8092e82 Whitespace normalization. Ugh, we really need to do this more often.
Neal Norwitz <nnorwitz@gmail.com>
parents: 41384
diff changeset
21
41384
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
22 if __name__ == '__main__':
712a15efcf19 Make test_softspace use unittest.
Collin Winter <collinw@gmail.com>
parents: 24364
diff changeset
23 test_main()