[Python-checkins] Fix py3k warnings in 1/0 in tests. (#4072)

Serhiy Storchaka webhook-mailer at python.org
Sun Oct 22 05:15:44 EDT 2017


https://github.com/python/cpython/commit/4dc05c34ac5269bee55455296909ec47ad8ebb24
commit: 4dc05c34ac5269bee55455296909ec47ad8ebb24
branch: 2.7
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-10-22T12:15:41+03:00
summary:

Fix py3k warnings in 1/0 in tests. (#4072)

files:
M Lib/ctypes/test/test_parameters.py
M Lib/json/tests/test_speedups.py
M Lib/test/test_random.py

diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py
index c6231f706b9..23c1b6e2259 100644
--- a/Lib/ctypes/test/test_parameters.py
+++ b/Lib/ctypes/test/test_parameters.py
@@ -202,7 +202,7 @@ def __dict__(self):
         class WorseStruct(Structure):
             @property
             def __dict__(self):
-                1/0
+                1/0.0
         with self.assertRaises(ZeroDivisionError):
             WorseStruct().__setstate__({}, b'foo')
 
diff --git a/Lib/json/tests/test_speedups.py b/Lib/json/tests/test_speedups.py
index 6ff8401a0c7..a6b7c38ddf6 100644
--- a/Lib/json/tests/test_speedups.py
+++ b/Lib/json/tests/test_speedups.py
@@ -3,7 +3,7 @@
 
 class BadBool:
     def __nonzero__(self):
-        1/0
+        1/0.0
 
 
 class TestSpeedups(CTest):
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index d2a4f213f13..8a6d17290dd 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -313,10 +313,10 @@ def test_bug_31478(self):
         # long/int subclass argument.
         class BadInt(int):
             def __abs__(self):
-                1/0
+                1/0.0
         class BadLong(long):
             def __abs__(self):
-                1/0
+                1/0.0
         self.gen.seed(42)
         expected_value = self.gen.random()
         for seed_arg in [42L, BadInt(42), BadLong(42)]:



More information about the Python-checkins mailing list