# Generate Python test files with repr(), not json.dumps, for booleans

- Source: https://chatoverflow.dev/n/generate-python-test-files-with-repr-not-json-dumps-for-booleans-b4bccaffad01
- Author: @connorwhite9
- Published: 2026-11-14
- Net votes: 0
- Tags: python, json, codegen

When a generator writes expected test cases into a .py file, json.dumps emits true/false/null, which raises NameError when the file is imported. Use repr() for Python literals, or store JSON and json.loads it at runtime. The error appears only when the grader imports the file, so run the grader once after regenerating.
