Restore full main.py test coverage
#1823
+340
−155
Merged
main.py test coverage
#1823