summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_decimal.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-01-08 19:04:16 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-01-08 19:04:16 (GMT)
commitce8e33a095030e7af94f58f9da196b240bdf0476 (patch)
treeb0ba50cbb6e85c6be6f6e6a870e4232be50a0f9c /Lib/test/test_decimal.py
parent3ddc435af6873c6304058d7bcbcb19ee4fba7781 (diff)
downloadcpython-ce8e33a095030e7af94f58f9da196b240bdf0476.zip
cpython-ce8e33a095030e7af94f58f9da196b240bdf0476.tar.gz
cpython-ce8e33a095030e7af94f58f9da196b240bdf0476.tar.bz2
Reverting the Revision: 77368. I committed Flox's big patch for tests by
mistake. ( It may come in for sure tough)
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r--Lib/test/test_decimal.py38
1 files changed, 14 insertions, 24 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index 9fef0d2..69f31a0 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -31,8 +31,7 @@ import pickle, copy
import unittest
from decimal import *
import numbers
-from test.test_support import (run_unittest, run_doctest,
- is_resource_enabled, check_warnings)
+from test.test_support import (run_unittest, run_doctest, is_resource_enabled)
import random
try:
import threading
@@ -203,7 +202,7 @@ class DecimalTest(unittest.TestCase):
if skip_expected:
raise unittest.SkipTest
return
- for line in open(file):
+ for line in open(file).xreadlines():
line = line.replace('\r\n', '').replace('\n', '')
#print line
try:
@@ -362,10 +361,8 @@ class DecimalTest(unittest.TestCase):
myexceptions = self.getexceptions()
self.context.clear_flags()
- # Silence Py3k warning
- with check_warnings():
- myexceptions.sort()
- theirexceptions.sort()
+ myexceptions.sort()
+ theirexceptions.sort()
self.assertEqual(result, ans,
'Incorrect answer for ' + s + ' -- got ' + result)
@@ -620,14 +617,12 @@ class DecimalImplicitConstructionTest(unittest.TestCase):
('//', '__floordiv__', '__rfloordiv__'),
('**', '__pow__', '__rpow__')
]
- # Silence Py3k warning
- with check_warnings():
- if 1/2 == 0:
- # testing with classic division, so add __div__
- oplist.append(('/', '__div__', '__rdiv__'))
- else:
- # testing with -Qnew, so add __truediv__
- oplist.append(('/', '__truediv__', '__rtruediv__'))
+ if 1/2 == 0:
+ # testing with classic division, so add __div__
+ oplist.append(('/', '__div__', '__rdiv__'))
+ else:
+ # testing with -Qnew, so add __truediv__
+ oplist.append(('/', '__truediv__', '__rtruediv__'))
for sym, lop, rop in oplist:
setattr(E, lop, lambda self, other: 'str' + lop + str(other))
@@ -1199,10 +1194,8 @@ class DecimalUsabilityTest(unittest.TestCase):
self.assertEqual(a, b)
# with None
- # Silence Py3k warning
- with check_warnings():
- self.assertFalse(Decimal(1) < None)
- self.assertTrue(Decimal(1) > None)
+ self.assertFalse(Decimal(1) < None)
+ self.assertTrue(Decimal(1) > None)
def test_copy_and_deepcopy_methods(self):
d = Decimal('43.24')
@@ -1711,14 +1704,11 @@ class ContextFlags(unittest.TestCase):
for flag in extra_flags:
if flag not in expected_flags:
expected_flags.append(flag)
+ expected_flags.sort()
# flags we actually got
new_flags = [k for k,v in context.flags.items() if v]
-
- # Silence Py3k warning
- with check_warnings():
- expected_flags.sort()
- new_flags.sort()
+ new_flags.sort()
self.assertEqual(ans, new_ans,
"operation produces different answers depending on flags set: " +