Closed mpsonntag closed 4 years ago
I also don't particularly enjoy the way the file creation strings are formatted in these tests, but in most cases it makes it easier to see at one glance what is being tested and how. I am not dogmatic about it though, if there are any suggestions for a different setup, let me know! :)
I also don't particularly enjoy the way the file creation strings are formatted in these tests, but in most cases it makes it easier to see at one glance what is being tested and how. I am not dogmatic about it though, if there are any suggestions for a different setup, let me know! :)
Could put them in a global fake constant in the file, right at the top, at indent level 0. Maybe something like:
file_content = """
Document:
id: 82408bdb-1d9d-4fa9-b4dd-ad78831c797c
sections:
- id: d4f3120a-c02f-4102-a9fe-2e8b77d1d0d2
name: sec
odml-version: '1.1'
""".strip()
That way you preserve the locality somewhat (it's in the same file), the content is indented as it will appear in the file without breaking flow, and the strip()
takes care of removing leading and trailing newlines.
I would like that and it also gives you the option to call the variable e.g. something like: invalid_file_missing_id = ""
or something similar
The XMLParser.Reader comes with an option to ignore errors when opening a file while notifying the user with all encountered odml format problems, enabling users to fix problematic odml files using the odml library instead of having to directly manipulate the file content.
This option has now been added to the DictParser.Reader as well, also allowing to open and fix problematic odml JSON and YAML files.
The PR
odml.load
function.format.revmap
where the reverse mapping of an odml attribute would always return the case that the attribute is part of the format, even if it was not.Don't be afraid, most of the changes in this PR again increase the test coverage.