def test_fstat(): result = nt.fstat(1) Assert(result!=0,"0,The file stat object was not returned correctly") result = None tmpfile = "tmpfile1.tmp" f = open(tmpfile, "w") result = nt.fstat(f.fileno()) Assert(result!=None,"0,The file stat object was not returned correctly") f.close() nt.unlink(tmpfile) # stdxx file descriptor AreEqual(10, len(nt.fstat(0))) AreEqual(10, len(nt.fstat(1))) AreEqual(10, len(nt.fstat(2))) # invalid file descriptor AssertError(OSError,nt.fstat,3000) AssertError(OSError,nt.fstat,-1)
def test_fstat(): result = nt.fstat(1) Assert(result != 0, "0,The file stat object was not returned correctly") result = None tmpfile = "tmpfile1.tmp" f = open(tmpfile, "w") result = nt.fstat(f.fileno()) Assert(result != None, "0,The file stat object was not returned correctly") f.close() nt.unlink(tmpfile) # stdxx file descriptor AreEqual(10, len(nt.fstat(0))) AreEqual(10, len(nt.fstat(1))) AreEqual(10, len(nt.fstat(2))) # invalid file descriptor AssertError(OSError, nt.fstat, 3000) AssertError(OSError, nt.fstat, -1)
def test_fstat(self): result = nt.fstat(1) self.assertTrue(result!=0,"0,The file stat object was not returned correctly") result = None tmpfile = "tmpfile1.tmp" f = open(tmpfile, "w") result = nt.fstat(f.fileno()) self.assertFalse(result is None,"0,The file stat object was not returned correctly") f.close() nt.unlink(tmpfile) # stdxx file descriptor self.assertEqual(10, len(nt.fstat(0))) self.assertEqual(10, len(nt.fstat(1))) self.assertEqual(10, len(nt.fstat(2))) # invalid file descriptor self.assertRaises(OSError,nt.fstat,3000) self.assertRaises(OSError,nt.fstat,-1)