def it_supports_indexed_access(self, _Cell_, cell_): tr = element('a:tr/(a:tc, a:tc, a:tc)') tcs = tr.xpath('//a:tc') _Cell_.return_value = cell_ cell_collection = _CellCollection(tr, None) cell = cell_collection[1] _Cell_.assert_called_once_with(tcs[1], cell_collection) assert cell is cell_
def it_supports_indexed_access(self, _Cell_, cell_): tr = element("a:tr/(a:tc, a:tc, a:tc)") tcs = tr.xpath("//a:tc") _Cell_.return_value = cell_ cell_collection = _CellCollection(tr, None) cell = cell_collection[1] _Cell_.assert_called_once_with(tcs[1], cell_collection) assert cell is cell_
def iter_fixture(self, request, _Cell_): tr_cxml = request.param tr = element(tr_cxml) tcs = tr.xpath('//a:tc') cell_collection = _CellCollection(tr, None) expected_cells = [ instance_mock(request, _Cell, name='cell%d' % idx) for idx in range(len(tcs)) ] _Cell_.side_effect = expected_cells calls = [call(tc, cell_collection) for tc in tcs] return cell_collection, _Cell_, calls, expected_cells
def iter_fixture(self, request, _Cell_): tr_cxml = request.param tr = element(tr_cxml) tcs = tr.xpath("//a:tc") cell_collection = _CellCollection(tr, None) expected_cells = [ instance_mock(request, _Cell, name="cell%d" % idx) for idx in range(len(tcs)) ] _Cell_.side_effect = expected_cells calls = [call(tc, cell_collection) for tc in tcs] return cell_collection, _Cell_, calls, expected_cells
def len_fixture(self, request): tr_cxml, expected_len = request.param cells = _CellCollection(element(tr_cxml), None) return cells, expected_len
def it_raises_on_indexed_access_out_of_range(self): cells = _CellCollection(element('a:tr/a:tc'), None) with pytest.raises(IndexError): cells[-1] with pytest.raises(IndexError): cells[9]
def it_raises_on_indexed_access_out_of_range(self): cells = _CellCollection(element("a:tr/a:tc"), None) with pytest.raises(IndexError): cells[-1] with pytest.raises(IndexError): cells[9]