[Python-checkins] CVS: python/dist/src/Lib/test test_grammar.py,1.16,1.17
Barry Warsaw
python-dev@python.org
Mon, 28 Aug 2000 21:56:48 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv31678
Modified Files:
test_grammar.py
Log Message:
Added tests of "print >> None"
Index: test_grammar.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** test_grammar.py 2000/08/22 02:43:07 1.16
--- test_grammar.py 2000/08/29 04:56:46 1.17
***************
*** 269,272 ****
--- 269,297 ----
print >> sys.stdout, 0 or 1
+ # test print >> None
+ class Gulp:
+ def write(self, msg): pass
+
+ def driver():
+ oldstdout = sys.stdout
+ sys.stdout = Gulp()
+ try:
+ tellme(Gulp())
+ tellme()
+ finally:
+ sys.stdout = oldstdout
+
+ # we should see this once
+ def tellme(file=sys.stdout):
+ print >> file, 'hello world'
+
+ driver()
+
+ # we should not see this at all
+ def tellme(file=None):
+ print >> file, 'goodbye universe'
+
+ driver()
+
# syntax errors
def check_syntax(statement):