Skip to content

Commit

Permalink
keep answer path
Browse files Browse the repository at this point in the history
when a %load magic is replaced with the contents of the file that it
loads, it keeps a comment with the name of the file
  • Loading branch information
cobac committed Feb 9, 2024
1 parent 2db2d95 commit 67760c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion asekuro/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def make_testable_notebook(nbpath, remove_meta=True):
.replace('%load ', '')
)
with open(py_path, 'r') as f:
cell['source'] = f.read()
cell['source'] = "Answer loaded from: " + py_path + "\n" + f.read()
logger.info(f'after loading cell content: {cell["source"]}')
nbformat.write(notebook, open(_testfile(nbpath=nbpath), mode='w'))
logger.info(f"wrote notebook ready for testing over at {_testfile(nbpath=nbpath)}")
Expand Down

0 comments on commit 67760c4

Please sign in to comment.