More code cleanup in spec_tests.py.