[Python-checkins] Replace 1/0 with 1//0 in tests to avoid Python 3 warns (GH-10833)

Victor Stinner webhook-mailer at python.org
Fri Nov 30 14:45:08 EST 2018


https://github.com/python/cpython/commit/2212ee2bee70fc9b4c76e79cc532f52673e5a13f
commit: 2212ee2bee70fc9b4c76e79cc532f52673e5a13f
branch: 2.7
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2018-11-30T20:45:04+01:00
summary:

Replace 1/0 with 1//0 in tests to avoid Python 3 warns (GH-10833)

Fix DeprecationWarning when tests are run using python -3.

files:
M Lib/test/test_bdb.py
M Lib/test/test_gdb.py
M Lib/test/test_sys_settrace.py

diff --git a/Lib/test/test_bdb.py b/Lib/test/test_bdb.py
index 4fb7c79cdcc5..d3ff8fc76860 100644
--- a/Lib/test/test_bdb.py
+++ b/Lib/test/test_bdb.py
@@ -868,7 +868,7 @@ def main():
         with create_modules(modules):
             self.expect_set = [
                 ('line', 2, 'tfunc_import'),
-                    break_in_func('func', TEST_MODULE_FNAME, False, '1 / 0'),
+                    break_in_func('func', TEST_MODULE_FNAME, False, '1 // 0'),
                 ('None', 2, 'tfunc_import'),       ('continue', ),
                 ('line', 3, 'func', ({1:1}, [])),  ('quit', ),
             ]
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
index 118dbbf0d9ef..335e48a24e68 100644
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -423,7 +423,7 @@ def test_exceptions(self):
         # Test division by zero:
         gdb_repr, gdb_output = self.get_gdb_repr('''
 try:
-    a = 1 / 0
+    a = 1 // 0
 except ZeroDivisionError, e:
     print e
 ''')
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index d8737af3bc8d..b6695fe012f8 100644
--- a/Lib/test/test_sys_settrace.py
+++ b/Lib/test/test_sys_settrace.py
@@ -1053,7 +1053,7 @@ def test_no_jump_from_return_event(output):
                "can only jump from a 'line' trace event"))
     def test_no_jump_from_exception_event(output):
         output.append(1)
-        1 / 0
+        1 // 0
 
     @jump_test(3, 2, [2], event='return', error=(ValueError,
                "can't jump from a yield statement"))



More information about the Python-checkins mailing list