nbval icon indicating copy to clipboard operation
nbval copied to clipboard

Cell numbers are off by 1 compared to what you see in the notebook

Open peytondmurray opened this issue 4 years ago • 1 comments

Hi all, I noticed the cell numbers reported by nbval are off by one from what you see in a jupyter notebook. Jupyter notebooks measure cell execution starting from 1, whereas nbval starts from 0. It would be a nice quality-of-life change to have the errors reported by nbval match up with the cell numbers in the notebook.

Here's an example notebook where I've generated output which doesn't match the expected output for the cell contents:

image

Notice that the cell number is 1 after freshly running the notebook from the beginning.

image

Here, pytest fails as expected, but the failure is in Cell 0.

peytondmurray avatar Aug 18 '21 20:08 peytondmurray

This is still an issue, but the branch for the fix has been deleted, so I will open a new PR with the one liner suggested in that review.

bsipocz avatar Jun 17 '25 04:06 bsipocz