Monday, April 23, 2018¶
I am working on #2368 (adapt the test suite) in order to
finish the eidreader project. I moved the test cases from welfare to
lino_book.projects.adg.
TIL: When you print() a dict to stdout, Python uses single
quotes around the keys:
>>> d = {'a': 1}
>>> print(d)
{'a': 1}
But that is not valid json:
>>> import json
>>> json.loads("""{'a': 1}""")
Traceback (most recent call last):
...
ValueError: Expecting property name: line 1 column 2 (char 1)
For json requires double quotes for dictionary keys:
>>> json.loads("""{"a": 1}""")
{u'a': 1}
I changed eidreader so that when invoked without any argument
it uses json.dumps() instead of print(). The advantage is
that I can now redirect the output of eidreader to the
beid_test_1.json file in lino_book.projects.adg.tests.