Skip to content
Prev Previous commit
Next Next commit
Added tests for to_string and to_latex
  • Loading branch information
mcocdawc authored and jreback committed Mar 6, 2017
commit a9bec302bd0b52aa2a93f3c77c0150582b24a283
11 changes: 11 additions & 0 deletions pandas/tests/formats/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,17 @@ def test_to_string_no_header(self):

self.assertEqual(df_s, expected)

def test_to_latex_specified_header(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to pandas/tests/formats/test_to_latex (new)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry that was the wrong function name. It should be:
test_to_string_specified_header

df = DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]})

df_s = df.to_string(header=['X', 'Y'])
expected = ' X Y\n0 1 4\n1 2 5\n2 3 6'

self.assertEqual(df_s, expected)

with tm.assertRaises(ValueError):
df.to_string(header=['X'])

def test_to_string_no_index(self):
df = DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]})

Expand Down