Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions petl/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
if PY2:
from itertools import ifilter, ifilterfalse, imap, izip, izip_longest
from string import maketrans
from decimal import Decimal
string_types = basestring,
integer_types = int, long
numeric_types = bool, int, long, float
numeric_types = bool, int, long, float, Decimal
text_type = unicode
binary_type = str
from urllib2 import urlopen
Expand All @@ -40,13 +41,14 @@
imap = map
izip = zip
xrange = range
from decimal import Decimal
from itertools import filterfalse as ifilterfalse
from itertools import zip_longest as izip_longest
from functools import reduce
maketrans = str.maketrans
string_types = str,
integer_types = int,
numeric_types = bool, int, float
numeric_types = bool, int, float, Decimal
class_types = type,
text_type = str
binary_type = bytes
Expand Down
5 changes: 3 additions & 2 deletions petl/test/test_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


from datetime import datetime
from decimal import Decimal


from petl.test.helpers import eq_
Expand Down Expand Up @@ -29,9 +30,9 @@ def test_comparable():
eq_(e, a)

# mixed numeric
d = [3., 1, 2.5]
d = [3., 1, 2.5, Decimal('1.5')]
a = sorted(d, key=Comparable)
e = [1, 2.5, 3.]
e = [1, Decimal('1.5'), 2.5, 3.]
eq_(e, a)

# mixed numeric and bool
Expand Down