def setUp(self): tbl_xml = ( '<a:tbl %s><a:tr h="370840"><a:tc><a:txBody><a:p/></a:txBody></a:' 'tc><a:tc><a:txBody><a:p/></a:txBody></a:tc></a:tr><a:tr h="37084' '0"><a:tc><a:txBody><a:p/></a:txBody></a:tc><a:tc><a:txBody><a:p/' '></a:txBody></a:tc></a:tr></a:tbl>' % nsdecls('a') ) test_tbl_elm = parse_xml_bytes(tbl_xml) self.rows = _RowCollection(test_tbl_elm, Mock(name='table'))
def len_fixture(self, request): tbl_cxml, expected_len = request.param rows = _RowCollection(element(tbl_cxml), None) return rows, expected_len
def iter_fixture(self, request): tbl_cxml = request.param tbl = element(tbl_cxml) rows = _RowCollection(tbl, None) expected_row_lst = tbl.findall(qn('a:tr')) return rows, expected_row_lst
def it_raises_on_indexed_access_out_of_range(self): rows = _RowCollection(element('a:tbl/a:tr'), None) with pytest.raises(IndexError): rows[-1] with pytest.raises(IndexError): rows[9]