[Python-checkins] python/dist/src/Lib/test test_unicode.py,1.75,1.76

doerwalter@users.sourceforge.net doerwalter@users.sourceforge.net
Sun, 19 Jan 2003 08:59:24 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv32572/Lib/test

Modified Files:
	test_unicode.py 
Log Message:
Port test_unicode.py to PyUnit and add tests for error
cases and a few methods. This increases code coverage
in Objects/unicodeobject.c from 81% to 85%.
(From SF patch #662807)


Index: test_unicode.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v
retrieving revision 1.75
retrieving revision 1.76
diff -C2 -d -r1.75 -r1.76
*** test_unicode.py	8 Jan 2003 23:02:34 -0000	1.75
--- test_unicode.py	19 Jan 2003 16:59:20 -0000	1.76
***************
*** 7,58 ****
  
  """#"
! from test.test_support import verify, vereq, verbose, TestFailed
! import sys, string
  
! if not sys.platform.startswith('java'):
!     # Test basic sanity of repr()
!     verify(repr(u'abc') == "u'abc'")
!     verify(repr(u'ab\\c') == "u'ab\\\\c'")
!     verify(repr(u'ab\\') == "u'ab\\\\'")
[...1882 lines suppressed...]
! 
!     def test_slice(self):
!         self.checkmethod('__getslice__', u'abc', u'abc', 0, 1000)
!         self.checkmethod('__getslice__', u'abc', u'abc', 0, 3)
!         self.checkmethod('__getslice__', u'abc', u'ab', 0, 2)
!         self.checkmethod('__getslice__', u'abc', u'bc', 1, 3)
!         self.checkmethod('__getslice__', u'abc', u'b', 1, 2)
!         self.checkmethod('__getslice__', u'abc', u'', 2, 2)
!         self.checkmethod('__getslice__', u'abc', u'', 1000, 1000)
!         self.checkmethod('__getslice__', u'abc', u'', 2000, 1000)
!         self.checkmethod('__getslice__', u'abc', u'', 2, 1)
!         # FIXME What about negative indizes? This is handled differently by [] and __getslice__
! 
! def test_main():
!     suite = unittest.TestSuite()
!     suite.addTest(unittest.makeSuite(UnicodeTest))
!     test.test_support.run_suite(suite)
! 
! if __name__ == "__main__":
!     test_main()