Receive "name 'unittests' is not defined" when running unit tests in C1M3_Assignment

Hi everyone. I’m still figuring out Jupyter notebooks so I may be doing something silly.

I’ve updated the cell containing the Graph_Advanced class in C1M3_Assignment.ipynb

When I attempt to run the unit tests in section 5 I receive:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[16], line 1
----> 1 unittests.test_shortest_path(Graph_Advanced)

NameError: name 'unittests' is not defined

unittests.py is in the same project folder as C1M3_Assignment. Am I missing a configuration line somewhere?

Many thanks.

Did you run the notebook cell which includes importing of your missin library.

2 Likes

Thanks Harri. Let me check that.

2 Likes

General tip:
Every time you open a notebook, use “Cell → Run all”, so that all of the necessary resources are imported and the workspace is updated with any functions you have already implemented.

3 Likes

Thanks Harry, TMosh - I hadn’t run the preceding cell that imports unittests.
Running it resolved the error.
Cheers.