[MRG + 1] Add tests for repr (#128)
* add tests for repr * remove repr for Cell * add round for repr of Cell * change decimal places to 2 * change tests for 2 decimal placespull/2/head
parent
f13337d50a
commit
c53ea795fd
|
|
@ -71,7 +71,7 @@ class Cell(object):
|
|||
|
||||
def __repr__(self):
|
||||
return '<Cell x1={} y1={} x2={} y2={}>'.format(
|
||||
self.x1, self.y1, self.x2, self.y2)
|
||||
round(self.x1, 2), round(self.y1, 2), round(self.x2, 2), round(self.y2, 2))
|
||||
|
||||
@property
|
||||
def text(self):
|
||||
|
|
|
|||
|
|
@ -138,3 +138,11 @@ def test_lattice_shift_text():
|
|||
|
||||
tables = camelot.read_pdf(filename, line_size_scaling=40, shift_text=['r', 'b'])
|
||||
assert df_rb.equals(tables[0].df)
|
||||
|
||||
|
||||
def test_repr():
|
||||
filename = os.path.join(testdir, "foo.pdf")
|
||||
tables = camelot.read_pdf(filename)
|
||||
assert repr(tables) == "<TableList n=1>"
|
||||
assert repr(tables[0]) == "<Table shape=(7, 7)>"
|
||||
assert repr(tables[0].cells[0][0]) == "<Cell x1=120.48 y1=218.42 x2=164.64 y2=233.89>"
|
||||
|
|
|
|||
Loading…
Reference in New Issue