Skip to content

Commit c8ac563

Browse files
committed
TST: fix unit test on platforms with different default libc float formatting
1 parent 0057a90 commit c8ac563

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

RELEASE.rst

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ pandas 0.9.0
194194
such as lambdas, to GroupBy.aggregate
195195
- Fix DataFrame.apply with axis=1 on a non-unique index (#1878)
196196
- Proper handling of Index subclasses in pandas.unique (#1759)
197+
- Set index names in DataFrame.from_records (#1744)
197198

198199
pandas 0.8.1
199200
============

pandas/tests/test_format.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,17 @@ def test_to_string_small_float_values(self):
374374
df = DataFrame({'a': [1.5, 1e-17, -5.5e-7]})
375375

376376
result = df.to_string()
377-
expected = (' a\n'
378-
'0 1.500000e+00\n'
379-
'1 1.000000e-17\n'
380-
'2 -5.500000e-07')
377+
# sadness per above
378+
if '%.4g' % 1.7e8 == '1.7e+008':
379+
expected = (' a\n'
380+
'0 1.500000e+000\n'
381+
'1 1.000000e-017\n'
382+
'2 -5.500000e-007')
383+
else:
384+
expected = (' a\n'
385+
'0 1.500000e+00\n'
386+
'1 1.000000e-17\n'
387+
'2 -5.500000e-07')
381388
self.assertEqual(result, expected)
382389

383390
# but not all exactly zero

0 commit comments

Comments
 (0)