detect.py: fix unit tests