Sneaking in development a half-hour at a time. The new metadata.py is coded. Changing it to read and write JSON instead of my own meta-format has greatly simplified the code here, and it will simplify the dozen or so modules that are clients of metadata.py, when I get around to them. But how I'm rewriting its unit test. That involves feeding it bad stuff of various kinds and checking the output log messages. I'm pleased with how specific the diagnostics are, that come out of json.py. Here's an example.
ERROR:metadata:Error decoding metadata: Unterminated string starting at: line 2 column 13 (char 13) ERROR:metadata:Text reads: {"VERSION": "2}
The middle line is the text from ValueError object produced by json.py. The third line comes from my code, which knows the starting point within the string where JSON was looking, and shows from there up to 100 characters further. This should make debugging bad user edits quite easy.
No comments:
Post a Comment