nbval icon indicating copy to clipboard operation
nbval copied to clipboard

Allow naming cells?

Open aldanor opened this issue 6 years ago • 2 comments

Currently, cells are named as 'Cell %d' % cell_num. This makes it hard to trace errors in case you have hundreds of cells.

Could the cells be possibly named? Either via cell metadata (given it's already supported anyway), or via inline comments, like # nbval: name = 'cell_name', or just # nbval: cell_name.

To enforce uniqueness, cell number can still be kept, so the output could look e.g. like this:

nbval_test.ipynb::Cell 0 [do_stuff] PASSED
nbval_test.ipynb::Cell 1 PASSED
nbval_test.ipynb::Cell 2 PASSED
nbval_test.ipynb::Cell 3 [other_stuff] FAILED
nbval_test.ipynb::Cell 4 PASSED
nbval_test.ipynb::Cell 5 [custom_name] PASSED
nbval_test.ipynb::Cell 6 PASSED

aldanor avatar Jan 16 '19 11:01 aldanor

I'd be OK with doing that based on cell metadata. Using comments for this feels like a bit too much magic parsing.

takluyver avatar Jan 16 '19 11:01 takluyver

at least should also use (cell_num + 1) by default to correspond to the numbering in the notebook

casperdcl avatar Mar 09 '21 01:03 casperdcl