diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2017-11-26 17:55:24 -0800 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2017-11-26 17:55:24 -0800 |
commit | 048f1bb95a8ad3863cdd02cd25a2786c48c8d91f (patch) | |
tree | cc19add495fb7c1eedb22f84f3199c154b7fff76 /tests | |
parent | 858bc3d42a4dfc65f6ec21e7ad28959f8255ab28 (diff) | |
download | psycopg2-048f1bb95a8ad3863cdd02cd25a2786c48c8d91f.tar.gz |
Remove workaround for decimal module
The decimal module is available on all Python versions supported by
psycopg2. It has been available since Python 2.4. No need to catch an
ImportError.
https://docs.python.org/2/library/decimal.html
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_cursor.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/tests/test_cursor.py b/tests/test_cursor.py index 10b8d71..7faaca6 100755 --- a/tests/test_cursor.py +++ b/tests/test_cursor.py @@ -98,11 +98,7 @@ class CursorTests(ConnectingTestCase): cur.mogrify(u"SELECT %s;", (snowman,))) def test_mogrify_decimal_explodes(self): - # issue #7: explodes on windows with python 2.5 and psycopg 2.2.2 - try: - from decimal import Decimal - except: - return + from decimal import Decimal conn = self.conn cur = conn.cursor() @@ -138,12 +134,8 @@ class CursorTests(ConnectingTestCase): self.assertEqual(42, curs.cast(20, '42')) self.assertAlmostEqual(3.14, curs.cast(700, '3.14')) - try: - from decimal import Decimal - except ImportError: - self.assertAlmostEqual(123.45, curs.cast(1700, '123.45')) - else: - self.assertEqual(Decimal('123.45'), curs.cast(1700, '123.45')) + from decimal import Decimal + self.assertEqual(Decimal('123.45'), curs.cast(1700, '123.45')) from datetime import date self.assertEqual(date(2011, 1, 2), curs.cast(1082, '2011-01-02')) |