from __future__ import absolute_import, print_function, division import petl as etl from petl.test.helpers import eq_ def test_repr(): table = (('foo', 'bar'), ('a', 1), ('b', 2), ('c', 2)) expect = str(etl.look(table)) actual = repr(etl.wrap(table)) eq_(expect, actual) def test_str(): table = (('foo', 'bar'), ('a', 1), ('b', 2), ('c', 2)) expect = str(etl.look(table, vrepr=str)) actual = str(etl.wrap(table)) eq_(expect, actual) def test_repr_html(): table = (('foo', 'bar'), ('a', 1), ('b', 2), ('c', 2)) expect = """
| foo | bar |
|---|---|
| a | 1 |
| b | 2 |
| c | 2 |
| foo | bar |
|---|---|
| a | 1 |
| b | 2 |
...
""" actual = etl.wrap(table)._repr_html_() print(actual) for l1, l2 in zip(expect.split('\n'), actual.split('\n')): eq_(l1, l2)