[Python-checkins] python/dist/src/Lib/test test_posix.py,1.2,1.3

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
2003年2月17日 14:40:35 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv16710/Lib/test
Modified Files:
	test_posix.py 
Log Message:
Make changes suggested by Walter to use self.assert*() methods.
Index: test_posix.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_posix.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_posix.py	17 Feb 2003 21:48:48 -0000	1.2
--- test_posix.py	17 Feb 2003 22:40:31 -0000	1.3
***************
*** 38,51 ****
 if posix_func is not None:
 posix_func()
! try:
! posix_func(1)
! except TypeError:
! pass
! else:
! raise TestFailed, '%s should take no arguments' % name
 
 def test_statvfs(self):
 if hasattr(posix, 'statvfs'):
! posix.statvfs(os.curdir)
 
 def test_fstatvfs(self):
--- 38,46 ----
 if posix_func is not None:
 posix_func()
! self.assertRaises(TypeError, posix_func, 1)
 
 def test_statvfs(self):
 if hasattr(posix, 'statvfs'):
! self.assert_(posix.statvfs(os.curdir))
 
 def test_fstatvfs(self):
***************
*** 53,57 ****
 fp = open(TESTFN)
 try:
! posix.fstatvfs(fp.fileno())
 finally:
 fp.close()
--- 48,52 ----
 fp = open(TESTFN)
 try:
! self.assert_(posix.fstatvfs(fp.fileno()))
 finally:
 fp.close()
***************
*** 73,76 ****
--- 68,72 ----
 try:
 fd = posix.dup(fp.fileno())
+ self.assert_(isinstance(fd, int))
 os.close(fd)
 finally:
***************
*** 102,106 ****
 fp = open(TESTFN)
 try:
! posix.fstat(fp.fileno())
 finally:
 fp.close()
--- 98,102 ----
 fp = open(TESTFN)
 try:
! self.assert_(posix.fstat(fp.fileno()))
 finally:
 fp.close()
***************
*** 108,143 ****
 def test_stat(self):
 if hasattr(posix, 'stat'):
! posix.stat(TESTFN)
 
 def test_chdir(self):
 if hasattr(posix, 'chdir'):
 posix.chdir(os.curdir)
! try:
! posix.chdir(TESTFN)
! except OSError:
! pass
! else:
! raise TestFailed, \
! 'should not be able to change directory to a file'
 
 def test_lsdir(self):
 if hasattr(posix, 'lsdir'):
! if TESTFN not in posix.lsdir(os.curdir):
! raise TestFailed, \
! '%s should exist in current directory' % TESTFN
 
 def test_access(self):
 if hasattr(posix, 'access'):
! if not posix.access(TESTFN, os.R_OK):
! raise TestFailed, 'should have read access to: %s' % TESTFN
 
 def test_umask(self):
 if hasattr(posix, 'umask'):
 old_mask = posix.umask(0)
 posix.umask(old_mask)
 
 def test_strerror(self):
 if hasattr(posix, 'strerror'):
! posix.strerror(0)
 
 def test_pipe(self):
--- 104,131 ----
 def test_stat(self):
 if hasattr(posix, 'stat'):
! self.assert_(posix.stat(TESTFN))
 
 def test_chdir(self):
 if hasattr(posix, 'chdir'):
 posix.chdir(os.curdir)
! self.assertRaises(OSError, posix.chdir, TESTFN)
 
 def test_lsdir(self):
 if hasattr(posix, 'lsdir'):
! self.assert_(TESTFN in posix.lsdir(os.curdir))
 
 def test_access(self):
 if hasattr(posix, 'access'):
! self.assert_(posix.access(TESTFN, os.R_OK))
 
 def test_umask(self):
 if hasattr(posix, 'umask'):
 old_mask = posix.umask(0)
+ self.assert_(isinstance(old_mask, int))
 posix.umask(old_mask)
 
 def test_strerror(self):
 if hasattr(posix, 'strerror'):
! self.assert_(posix.strerror(0))
 
 def test_pipe(self):
***************
*** 149,155 ****
 def test_tempnam(self):
 if hasattr(posix, 'tempnam'):
! posix.tempnam()
! posix.tempnam(os.curdir)
! posix.tempnam(os.curdir, 'blah')
 
 def test_tmpfile(self):
--- 137,143 ----
 def test_tempnam(self):
 if hasattr(posix, 'tempnam'):
! self.assert_(posix.tempnam())
! self.assert_(posix.tempnam(os.curdir))
! self.assert_(posix.tempnam(os.curdir, 'blah'))
 
 def test_tmpfile(self):

AltStyle によって変換されたページ (->オリジナル) /