Add unit tests and fix some false positives when checking for calls to register_widget()

@nb For sure. I can switch it out with a regular expression to make it more robust and reduce false positives.