[Python-checkins] CVS: python/dist/src/Lib/test test_os.py,NONE,1.2.2.1 test_parser.py,1.6.6.2,1.6.6.3
Tim Peters
tim_one@users.sourceforge.net
Tue, 17 Jul 2001 21:13:58 -0700
- Previous message: [Python-checkins] CVS: python/dist/src/Doc/texinputs boilerplate.tex,1.62,1.62.2.1 license.tex,1.1,1.1.6.1 python.sty,1.78,1.78.2.1
- Next message: [Python-checkins] CVS: python/dist/src/Mac/Modules/cf CFmodule.c,1.4,1.4.2.1 cfscan.py,1.4,1.4.2.1 cfsupport.py,1.5,1.5.2.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv20213/descr/dist/src/Lib/test
Modified Files:
Tag: descr-branch
test_parser.py
Added Files:
Tag: descr-branch
test_os.py
Log Message:
2.2a1 release: merge of trunk date2001-07-17a -> trunk date2001-07-17b.
--- NEW FILE: test_os.py ---
# As a test suite for the os module, this is woefully inadequate, but this
# does add tests for a few functions which have been determined to be more
# more portable than they had been thought to be.
import os
import unittest
from test_support import TESTFN, run_unittest
class TemporaryFileTests(unittest.TestCase):
def setUp(self):
self.files = []
os.mkdir(TESTFN)
def tearDown(self):
for name in self.files:
os.unlink(name)
os.rmdir(TESTFN)
def check_tempfile(self, name):
# make sure it doesn't already exist:
self.failIf(os.path.exists(name),
"file already exists for temporary file")
# make sure we can create the file
open(name, "w")
self.files.append(name)
def test_tempnam(self):
if not hasattr(os, "tempnam"):
return
self.check_tempfile(os.tempnam())
name = os.tempnam(TESTFN)
self.check_tempfile(name)
name = os.tempnam(TESTFN, "pfx")
self.assert_(os.path.basename(name)[:3] == "pfx")
self.check_tempfile(name)
def test_tmpfile(self):
if not hasattr(os, "tmpfile"):
return
fp = os.tmpfile()
fp.write("foobar")
fp.seek(0,0)
s = fp.read()
fp.close()
self.assert_(s == "foobar")
def test_tmpnam(self):
if not hasattr(os, "tmpnam"):
return
self.check_tempfile(os.tmpnam())
run_unittest(TemporaryFileTests)
Index: test_parser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_parser.py,v
retrieving revision 1.6.6.2
retrieving revision 1.6.6.3
diff -C2 -r1.6.6.2 -r1.6.6.3
*** test_parser.py 2001/07/17 04:19:05 1.6.6.2
--- test_parser.py 2001/07/18 04:13:56 1.6.6.3
***************
*** 14,18 ****
t = st1.totuple()
try:
! st2 = parser.sequence2ast(t)
except parser.ParserError:
self.fail("could not roundtrip %r" % s)
--- 14,18 ----
t = st1.totuple()
try:
! st2 = parser.sequence2st(t)
except parser.ParserError:
self.fail("could not roundtrip %r" % s)
***************
*** 141,145 ****
def check_bad_tree(self, tree, label):
try:
! parser.sequence2ast(tree)
except parser.ParserError:
pass
--- 141,145 ----
def check_bad_tree(self, tree, label):
try:
! parser.sequence2st(tree)
except parser.ParserError:
pass
- Previous message: [Python-checkins] CVS: python/dist/src/Doc/texinputs boilerplate.tex,1.62,1.62.2.1 license.tex,1.1,1.1.6.1 python.sty,1.78,1.78.2.1
- Next message: [Python-checkins] CVS: python/dist/src/Mac/Modules/cf CFmodule.c,1.4,1.4.2.1 cfscan.py,1.4,1.4.2.1 cfsupport.py,1.5,1.5.2.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]