Fixes API bugs in name-path.cpp.
Major test restructuring.

This patch massively restructures (and breaks!) the way the Python tests
are handled. Further commits will resolve the issue.