fix test code in generate.py