def test_find_all_keys(get_notebook): keys = utils.find_all_keys(get_notebook("with_glue.ipynb")) assert set(keys) == { "key_text1", "key_float", "key_undisplayed", "key_df", "key_plt", "sym_eq", }
def add_notebook(self, ntbk, docname): """Find all glue keys from the notebook and add to the cache.""" new_keys = find_all_keys( ntbk, existing_keys={v: k for k, vs in self.docmap.items() for v in vs}, path=str(docname), logger=SPHINX_LOGGER, ) self.docmap[str(docname)] = set(new_keys) self.cache.update(new_keys)