How to use the ipysheet.hold_cells function in ipysheet

To help you get started, we’ve selected a few ipysheet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github QuantStack / ipysheet / ipysheet / test_all.py View on Github external
r.value = [[1, 2]]
    assert r.value == transpose(valueT)

    rT = ipysheet.cell_range(valueT, transpose=True)  # 3 rows, 2 columns
    with pytest.raises(ValueError):
        rT.value = 1
    with pytest.raises(ValueError):
        rT.value = [1, 2, 3]
    with pytest.raises(ValueError):
        rT.value = [[1, 2]]
    rT.value = transpose(value)
    assert rT.value == transpose(value)

    sheet = ipysheet.sheet(rows=3, columns=4)
    assert len(sheet.cells) == 0
    with ipysheet.hold_cells():
        ipysheet.cell_range(value)
        ipysheet.cell_range(value)
        assert len(sheet.cells) == 0
    assert len(sheet.cells) == 2
github QuantStack / ipysheet / ipysheet / test_all.py View on Github external
ipysheet.cell(0, 0, value='2')
    ipysheet.cell(0, 1, value='2')
    assert len(sheet1.cells) == 2
    assert len(sheet2.cells) == 1

    with ipysheet.hold_cells():
        ipysheet.cell(1, 0, value='3')
        ipysheet.cell(1, 1, value='4')
        assert len(sheet1.cells) == 2
        assert len(sheet2.cells) == 1
    assert len(sheet1.cells) == 4
    assert len(sheet2.cells) == 1

    # nested hold cells
    sheet1 = ipysheet.sheet()
    with ipysheet.hold_cells():
        with ipysheet.hold_cells():
            ipysheet.cell(1, 0, value='3')
            ipysheet.cell(1, 1, value='4')
            assert len(sheet1.cells) == 0
        assert len(sheet1.cells) == 0
    assert len(sheet1.cells) == 2