You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ pytest 'scripts\test_gridspec.py'
Test session starts (platform: win32, Python 3.7.6, pytest 5.4.2, pytest-sugar 0.9.3)
rootdir: C:\repos\private\awesome-panel, inifile: pytest.ini
plugins: cov-2.8.1, mock-3.1.0, sugar-0.9.3
collecting ...
――――――――――――――――――――――――――― test_gridspec_ncols ――――――――――――――――――――――――――――
def test_gridspec_ncols():
grid = pn.layout.GridSpec(ncols=3)
forindexin range(0,5):
> grid[index,:]=pn.pane.Markdown("Hello World")
scripts\test_gridspec.py:6:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = GridSpec(ncols=3, nrows=4)
[0] Markdown(str)
[1] Markdown(str)
[2] Markdown(str)
[3] Markdown(str)
index = (4, slice(None, None, None)), obj = Markdown(str)
def __setitem__(self, index, obj):
from ..pane.base import panel
if not isinstance(index, tuple):
raise IndexError('Must supply a 2D index for GridSpec assignment.')
yidx, xidx = index
if isinstance(xidx, slice):
x0, x1 = (xidx.start, xidx.stop)
else:
x0, x1 = (xidx, xidx+1)
if isinstance(yidx, slice):
y0, y1 = (yidx.start, yidx.stop)
else:
y0, y1 = (yidx, yidx+1)
l = 0 if x0 is None else x0
r = self.nrows if x1 is None else x1
t = 0 if y0 is None else y0
b = self.ncols if y1 is None else y1
if self._cols_fixed and (l >= self.ncols or r > self.ncols):
> raise IndexError('Assigned object to column(s) out-of-bounds ''of the grid declared by `ncols`. which '
f'was set to {self.ncols}.')
E IndexError: Assigned object to column(s) out-of-bounds of the grid declared by `ncols`. which was set to 3.
.venv\lib\site-packages\panel\layout\grid.py:416: IndexError
scripts/test_gridspec.py ⨯ 100% ██████████
========================= short test summary info ==========================
FAILED scripts/test_gridspec.py::test_gridspec_ncols - IndexError: Assigne...
Results (1.47s):
1 failed
- scripts/test_gridspec.py:3 test_gridspec_ncols
I would expect to be able to add any number of rows. I only set a limit on the number of columns.
Additional Context
I use a similar script on awesome-panel.org to convert from a ListLike specification of panels to a GridSpec such that I can use all templates together on awesome-panel.org.
The text was updated successfully, but these errors were encountered:
I have a hard time figure out how the naming works, it would be nice with a docstring telling what the names means.
But for me it make sense that r should be related to self.ncols when I look at the if-statement and the same for b and self.nrows.
If I have understood it correct, I can make a PR for it. :)
I'm on Panel 0.10.0
If I run
pytest
on the belowI would expect to be able to add any number of rows. I only set a limit on the number of columns.
Additional Context
I use a similar script on awesome-panel.org to convert from a ListLike specification of panels to a GridSpec such that I can use all templates together on awesome-panel.org.
The text was updated successfully, but these errors were encountered: