Skip to content

Commit 3e15fa3

Browse files
authored
Merge pull request #2 from kiesraad/update-docs
Update documentation
2 parents f74ed59 + ea6ead9 commit 3e15fa3

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,4 @@ cython_debug/
160160
#.idea/
161161

162162
# Testdata
163-
test/data
163+
data

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Python bindings for the EML_NL Standard
2-
Data bindings for the EML_NL Standard to load EML_NL files into Python [dataclasses](https://docs.python.org/3/library/dataclasses.html) with correct structure, datatypes and typehints following the [EML_NL Xml Schema Definitions](https://www.kiesraad.nl/adviezen-en-publicaties/formulieren/2016/osv/eml-bestanden/eml_nl_1_2_1-xsd). Type hints can be staticically checked using [mypy](https://mypy-lang.org/) or [pyright](https://github.com/microsoft/pyright).
2+
Data bindings for the EML_NL Standard to load EML_NL files into Python [dataclasses](https://docs.python.org/3/library/dataclasses.html) with correct structure, datatypes and typehints following the [EML_NL Xml Schema Definitions](https://www.kiesraad.nl/adviezen-en-publicaties/formulieren/2016/osv/eml-bestanden/eml_nl_1_2_1-xsd). Type hints can be statically checked using [mypy](https://mypy-lang.org/) or [pyright](https://github.com/microsoft/pyright).
33

44
## Requirements
5-
- At least Python version 3.10 for the [KW_ONLY](https://docs.python.org/3/library/dataclasses.html#dataclasses.KW_ONLY) type annotations for dataclasses. This is so that non-nullable fields can be marked as mandatory (see [here](https://xsdata.readthedocs.io/en/latest/faq/why-non-nullable-fields-are-marked-as-optional.html)).
6-
- [xsData](https://github.com/tefra/xsdata) for parsing using these databindings.
5+
- At least Python version 3.10 for the [KW_ONLY](https://docs.python.org/3/library/dataclasses.html#dataclasses.KW_ONLY) type annotations for dataclasses. This is so that non-nullable fields can be marked as mandatory (refer to [xsdata documentation](https://xsdata.readthedocs.io/en/latest/faq/why-non-nullable-fields-are-marked-as-optional.html)).
6+
- [xsData](https://github.com/tefra/xsdata) for parsing using these data bindings.
7+
8+
For running tests, additionally:
9+
- [pytest](https://docs.pytest.org/) for the test framework.
10+
- [formencode](http://www.formencode.org/) for XML comparison.
711

812
## Testing
9-
The bindings are tested on over 2500 different EML files from different type of Dutch elections, all downloaded from [data.overheid.nl](https://data.overheid.nl/community/organization/kiesraad) using a roundtrip serialization test.
13+
The bindings are tested on over 2500 different EML files from different type of Dutch elections, all downloaded from [data.overheid.nl](https://data.overheid.nl/community/organization/kiesraad) using a roundtrip serialization test. To run the tests, install the test dependencies (see above), put EML files into a `data` folder and run `pytest` in the root folder.
1014

1115
See the [test report](pyeml_bindings_testreport.html)
1216

@@ -43,7 +47,6 @@ with open(Path("output.xml"), "w") as out_file:
4347
# to use the same namespace prefixes.
4448
# If we don't, we still get back valid EML but with ns0, ns1 etc.
4549
serializer.write(out=out_file, obj=eml, ns_map=NAMESPACE)
46-
4750
```
4851

4952
## Building

tests/test_roundtrip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def parsing_roundtrip_same(parser, serializer, reporter, path_to_eml, type) -> b
2727

2828
parser = XmlParser(ParserConfig(fail_on_unknown_properties=False))
2929
serializer = XmlSerializer()
30-
reporter = lambda x: stdout.write(x + "\n")
30+
reporter = print
3131
files = glob.glob(f"data/**/*.eml.xml", recursive=True)
3232

3333
test_cases = zip(

0 commit comments

Comments
 (0)