def test_strip_test_cells(remove_cells_notebooks): root = remove_cells_notebooks[0].parent examples.strip_special_cells(root) nbfiles = examples.find_notebook_files(root) assert len(nbfiles) == len(remove_cells_notebooks) for nbfile in nbfiles: with nbfile.open("r") as f: nbdata = json.load(f) if not nbfile.stem.endswith("_testing"): for cell in nbdata["cells"]: cell_meta = cell["metadata"] tags = cell_meta.get("tags", []) assert examples.REMOVE_CELL_TAG not in tags # tag is gone else: n = 0 for cell in nbdata["cells"]: cell_meta = cell["metadata"] tags = cell_meta.get("tags", []) if examples.REMOVE_CELL_TAG in tags: n += 1 assert n > 0 # tag still there
def test_find_notebook_files(remove_cells_notebooks): root = remove_cells_notebooks[0].parent nbfiles = examples.find_notebook_files(root) assert len(nbfiles) == len(remove_cells_notebooks) for nbfile in nbfiles: assert nbfile in remove_cells_notebooks