summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-08-12 04:12:14 (GMT)
committerGitHub <noreply@github.com>2024-08-12 04:12:14 (GMT)
commit9375b9ca3a4998678ba74ff5c77ed540a4dcf887 (patch)
tree771e3443580e491b86fc31669123e45d61801b74 /Lib/test
parent6aa35f3002dda25858d47e702e750e2871e42a7c (diff)
downloadcpython-9375b9ca3a4998678ba74ff5c77ed540a4dcf887.zip
cpython-9375b9ca3a4998678ba74ff5c77ed540a4dcf887.tar.gz
cpython-9375b9ca3a4998678ba74ff5c77ed540a4dcf887.tar.bz2
Remove "print >>obj" exception hint for Python 2 (#122853)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_print.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/Lib/test/test_print.py b/Lib/test/test_print.py
index 5f1bfd9..f4805a1 100644
--- a/Lib/test/test_print.py
+++ b/Lib/test/test_print.py
@@ -188,38 +188,6 @@ class TestPy2MigrationHint(unittest.TestCase):
self.assertIn("Missing parentheses in call to 'print'. Did you mean print(...)",
str(context.exception))
- def test_stream_redirection_hint_for_py2_migration(self):
- # Test correct hint produced for Py2 redirection syntax
- with self.assertRaises(TypeError) as context:
- print >> sys.stderr, "message"
- self.assertIn('Did you mean "print(<message>, '
- 'file=<output_stream>)"?', str(context.exception))
-
- # Test correct hint is produced in the case where RHS implements
- # __rrshift__ but returns NotImplemented
- with self.assertRaises(TypeError) as context:
- print >> 42
- self.assertIn('Did you mean "print(<message>, '
- 'file=<output_stream>)"?', str(context.exception))
-
- # Test stream redirection hint is specific to print
- with self.assertRaises(TypeError) as context:
- max >> sys.stderr
- self.assertNotIn('Did you mean ', str(context.exception))
-
- # Test stream redirection hint is specific to rshift
- with self.assertRaises(TypeError) as context:
- print << sys.stderr
- self.assertNotIn('Did you mean', str(context.exception))
-
- # Ensure right operand implementing rrshift still works
- class OverrideRRShift:
- def __rrshift__(self, lhs):
- return 42 # Force result independent of LHS
-
- self.assertEqual(print >> OverrideRRShift(), 42)
-
-
if __name__ == "__main__":
unittest.main()