Skip to content

Commit cf1bd48

Browse files
committed
Merged in simonpercivall/python-tabulate (pull request astanin#22 + regression test)
2 parents 67bd376 + 1ccc2ca commit cf1bd48

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

tabulate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def _type(string, has_invisible=True):
388388
elif _isint(string):
389389
return int
390390
elif _isint(string, _long_type):
391-
return _long_type
391+
return int
392392
elif _isnumber(string):
393393
return float
394394
elif isinstance(string, _binary_type):
@@ -568,7 +568,7 @@ def _format(val, valtype, floatfmt, missingval="", has_invisible=True):
568568
if val is None:
569569
return missingval
570570

571-
if valtype in [int, _long_type, _text_type]:
571+
if valtype in [int, _text_type]:
572572
return "{0}".format(val)
573573
elif valtype is _binary_type:
574574
try:

test/test_regression.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,15 @@ def test_long_integers():
216216
assert_equal(result, expected)
217217

218218

219+
def test_align_long_integers():
220+
"Regression: long integers should be aligned as integers (issue #61)"
221+
table = [[long(1)], [long(234)]]
222+
result = tabulate(table, tablefmt="plain")
223+
expected = "\n".join([" 1",
224+
"234"])
225+
assert_equal(result, expected)
226+
227+
219228
def test_colorclass_colors():
220229
"Regression: ANSI colors in a unicode/str subclass (issue #49)"
221230
try:

0 commit comments

Comments
 (0)