summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_grammar.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_grammar.py')
-rw-r--r--Lib/test/test_grammar.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index b0e3da9..ef7c09b 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -268,6 +268,31 @@ print >> sys.stdout
print >> sys.stdout, 0 or 1, 0 or 1,
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):
try: