components/python/python27/patches/21-test_tcl.patch
author John Beck <John.Beck@Oracle.COM>
Thu, 17 Jul 2014 21:06:55 -0700
changeset 2027 cd5205b6221a
permissions -rw-r--r--
19164544 Python 2.7 test_tcl fails
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2027
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     1
This patch comes from upstream: http://bugs.python.org/issue21881
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     2
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     3
--- Python-2.7.8/Lib/test/test_tcl.py.~1~	2014-06-29 19:05:37.000000000 -0700
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     4
+++ Python-2.7.8/Lib/test/test_tcl.py	2014-07-17 20:50:53.804037105 -0700
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     5
@@ -420,10 +420,9 @@
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     6
             self.assertEqual(passValue(float('inf')), float('inf'))
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     7
             self.assertEqual(passValue(-float('inf')), -float('inf'))
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     8
         else:
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     9
-            f = float(passValue(float('nan')))
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    10
-            self.assertNotEqual(f, f)
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    11
             self.assertEqual(float(passValue(float('inf'))), float('inf'))
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    12
             self.assertEqual(float(passValue(-float('inf'))), -float('inf'))
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    13
+            # XXX NaN representation can be not parsable by float()
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    14
         self.assertEqual(passValue((1, '2', (3.4,))),
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    15
                          (1, '2', (3.4,)) if self.wantobjects else '1 2 3.4')
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    16
 
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    17
@@ -448,9 +447,6 @@
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    18
             expected = float(expected)
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    19
             self.assertAlmostEqual(float(actual), expected,
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    20
                                    delta=abs(expected) * 1e-10)
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    21
-        def nan_eq(actual, expected):
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    22
-            actual = float(actual)
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    23
-            self.assertNotEqual(actual, actual)
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    24
 
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    25
         check(True, '1')
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    26
         check(False, '0')
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    27
@@ -474,7 +470,7 @@
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    28
             check(f, f, eq=float_eq)
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    29
         check(float('inf'), 'Inf', eq=float_eq)
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    30
         check(-float('inf'), '-Inf', eq=float_eq)
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    31
-        check(float('nan'), 'NaN', eq=nan_eq)
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    32
+        # XXX NaN representation can be not parsable by float()
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    33
         check((), '')
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    34
         check((1, (2,), (3, 4), '5 6', ()), '1 2 {3 4} {5 6} {}')
cd5205b6221a 19164544 Python 2.7 test_tcl fails
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    35