home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 June / maximum-cd-2011-06.iso / DiscContents / LibO_3.3.1_Win_x86_install_multi.exe / libreoffice1.cab / test_softspace.py < prev    next >
Encoding:
Python Source  |  2011-02-15  |  640 b   |  24 lines

  1. from test.test_support import run_unittest
  2. import unittest
  3. import StringIO
  4.  
  5. class SoftspaceTests(unittest.TestCase):
  6.     def test_bug_480215(self):
  7.         # SF bug 480215:  softspace confused in nested print
  8.         f = StringIO.StringIO()
  9.         class C:
  10.             def __str__(self):
  11.                 print >> f, 'a'
  12.                 return 'b'
  13.  
  14.         print >> f, C(), 'c ', 'd\t', 'e'
  15.         print >> f, 'f', 'g'
  16.         # In 2.2 & earlier, this printed ' a\nbc  d\te\nf g\n'
  17.         self.assertEqual(f.getvalue(), 'a\nb c  d\te\nf g\n')
  18.  
  19. def test_main():
  20.     run_unittest(SoftspaceTests)
  21.  
  22. if __name__ == '__main__':
  23.     test_main()
  24.