Commit 005ec93
Some small fixes to be compatible with a database structure (#28)
* Add Links in README.rst to Open PR/Draft a Release
* Add more detail to serialization test
* Correct typos in test_missing_required_attributes
* Fix typo in street name
* Add postfach as alternative to strasse
Before strasse and hausnummer were required attributes and postfach was optional. Since postfach should be an alternative address to strasse and hausnummer this was changed to either strasse and hausnummer or postfach are required attributes.
Additionally the other required attributes are made sure to be strings and not empty.
* ✅ Add tests for postfach as required field
Add two test: one for postfach as regular required field, the second for different combinations of strasse, hausnummer and postfach to test the validator in the Adresse class (adresse.py)
* Add assertion for landescode
Co-authored-by: hf-krechan <68426071+hf-krechan@users.noreply.github.com>
* Correct Landescode assertion
Landescode has to be an Enum
* Update address requirements
The minimal address in Germany is only a zip code and city (for example for institutions like universities or big companies or postfächer without a number but a special zip code)
A street always needs a hausnummer and vice versa.
Postfächer don't have a street, but a number OR a zipcode.
* ✅ Update tests for updated address requirements
Added test for only postleitzahl and ort
Added docstrings to serialization tests of strasse and postleitzahl
Updated test for the function strasse_xor_postfach in Class Adresse (adresse.py) for the updates in the requirements of a german address
* 🏷️ fix wrongly defined enumerations
* ✅ update the tests accordingly.
* ➕ Add marshmallow and marshmallow-enum to dependencies
* ♻️ Rebuild serialisation with marshmallow instead of jsons
* ✅ Fix tests to match new serialisation setup with marshmallow
* 🐛 Fix case conversion during de-/serialisiation
Javascript uses CamelCase and python uses snake_case.
Therefore you have to convert the keys during the de- and serialisation
* ➖ remove jsons dependency
I will miss you 😥
* 🩹 Remove jsons import in test_adresse
* ♻️ Replace jsons with marshmallow in externereferenz
* ♻️ Replace jsons with marshmallow in geokoordinaten
* ✅ Add test for deserialisation of geschaeftspartner
* ♻️ Replace jsons with marshmallow in katasteradresse
* Replace jsons with marshmallow
For marshmallow we have to create a Schema for each class we would like to de-/serialise.
* Fix casing
* 🔥 Remove old code
* ✅ Update tests to marshmallow de-/serialisation
* ♻️ Improve deserialisation of all Geschaeftsobjekte
Thanks to Jack Smith we got a nice and central way to deserialise Geschaeftsobjekte. The new ansatz reduces also the amount of source code
https://stackoverflow.com/questions/65668561/marshmallow-schema-and-class-inheritance/65668854#65668854
* ✅ Update assertions for geschaeftsobjekt test
* 🎨 Rename deserialisation functions
* ♻️ Replace jsons with marshmallow in setup.cfg
* 🔥 Remove jsons import
* 🎨 Add new lines at the end of files
* ➖ ➕ Replace jsons with marshmallow and marshmallow-enum
* 📝 Automatically documentation update
* 💡 Add docstring to JavaScriptMixin class
The docstring explains the purpose of th functions to_snakecase and to_camelcase
* 💡 Add comments to clarify which attributes are required or optional
Rearranged lines to the required and optional categories to get a better overview.
* 💡 Translate and rearrange docstrings
* 🎨 Remove JavaScriptMixin from GeschaeftsobjektSchema children
The GeschaeftsobjektSchema has already the JavaScriptMixin. This property will inherited, so there is no need to inherit JavaScriptMixin in each BO
* 🎨 Remove bo_typ from BO Schemas
bo_typ is already defined in GeschaeftsobjektSchema.
Cause all BOs-Schema inherit from GeschaeftsobjektSchema the attribute bo_typ is already defined.
* 💡 Add explanation for the class_name variable
* 🎨 Move bo_typ to the required attributes
remove additional section called `required attributes with default value`
You can quickly see if an attribute use a default value
* 💡 Translate and reformat docstring
* ✅ Add assertion for BoTyp.MARKTLOKATION
* 🐛 Make marktlokation to required attribute
* 🐛 Make unterbrechbar an optional attribute
* 🐛 Use nested GeschaeftspartnerSchema for endkunde
Before it was a string field, which leads to errors after deserialisation.
You would get a string object in endkunde, but we would like to have a Geschaeftspartner object.
* ✅ Update tests for de-/serialisation of marktlokation
Test serialisation with required attributes only as well as required attributes plus optional attributes.
Additionally I added a test for a broken json_string which misses the required attribute marktlokations_id.
* 🔥 Remove not used packages from the documentation
* ✅ Switch result and expection
Co-authored-by: hf-kklein <konstantin.klein@hochfrequenz.de>
* Add component messlokationszuordnung
* ✅ Add tests for messlokationszuordnung
* Add enumeration ArithmetischeOperation
This is needed by the component messlokationszuordnung
* 🐛 Make postleitzahl and ort required in address
postleitzahl and ort were optional, but they are necessary for each kind of address.
* 🐛 Change zugehoerige_messlokation from string to Messlokation
zugehoerige_messlokation should be a Messlokationszuordnung object.
So this commit changes the typehint in the class Messlokationszuordnung and the related marshmallow schema
* 🖤 black formatting
* 📝 Update documentation
Add component messlokationszuordnung and enumeration arithmetische operation
* 🎨 Remove one whitespace
Flake8 does not like double spaces after assert
* Improve translated docstring of Geschaeftspartner
Co-authored-by: hf-kklein <konstantin.klein@hochfrequenz.de>
* Improve translated docstring for Marktlokation
Co-authored-by: hf-kklein <konstantin.klein@hochfrequenz.de>
* 💡 Improve understanding of docstring in cases.py
Co-authored-by: hf-kklein <konstantin.klein@hochfrequenz.de>
* ✏️ Fix typo
Co-authored-by: hf-kklein <konstantin.klein@hochfrequenz.de>
* ✅ Specify the assumption in test
The `is` operator is stricter than the `==` operator. Besides the value, the type is also compared
Co-authored-by: hf-kklein <konstantin.klein@hochfrequenz.de>
* ✏️ Fix typo in comment
Co-authored-by: hf-aschloegl <73470827+hf-aschloegl@users.noreply.github.com>
* ✏️ Fix typo in comment
Co-authored-by: hf-aschloegl <73470827+hf-aschloegl@users.noreply.github.com>
* ✏️ Fix typo in comment
Co-authored-by: hf-aschloegl <73470827+hf-aschloegl@users.noreply.github.com>
* 💡 Switch to American English
Cause this is an open source project and the American English is the international English version we should use it
* 👥 Add Annika to contributors
* 🔧 Add marshmallow-enum and stringcase to setup.py
New dependencies for our bo4e package.
Came through the shift from jsons to marshmallow
* 💡 Add comment to test_marktlokation for clarification
* 💡 Remove unnecessary comment
* 💡 Improve the understanding of a comment
Co-authored-by: hf-aschloegl <73470827+hf-aschloegl@users.noreply.github.com>
* 💡 Translate comments in marktrolle.py
Co-authored-by: hf-kklein <konstantin.klein@hochfrequenz.de>
* 🎨 Change order of odd and even checksum
To be more consistent with the BDEW Anwendungshilfe
https://bdew-codes.de/Content/Files/MaLo/2017-04-28-BDEW-Anwendungshilfe-MaLo-ID_Version1.0_FINAL.PDF
* ✅ Use dictionaries for assertions instead of strings
* 💩 Update tox.ini to get a positive linter check
I will remove the E501 (ignore line length) in the next PR.
I will update the format settings for black and flake9 in the next PR
* 💡 Translate docstring for gebietstyp.py
* ✏️ Fix typo in the word function
* ✏️Fix typos
* 💡 Translate comments
Co-authored-by: hf-aschloegl <73470827+hf-aschloegl@users.noreply.github.com>
* 💡 Add Multiplikation and Division as arithmetic operations in docstring
* ✏️ Fix typo in gebiettyp
Remove s in gebietstyp to match the same naming like the BO4E documenation
* 🐛 Set empty list to default for externe_referenzen
Empty list makes the implementation into a database easier compared to None type.
* 🩹 Add BoTyp.GESCHAEFTSOBJEKT and set it to default
The BoTyp can be used as a descriminator in databases.
But the Geschaeftsobjekt itself has no BoTyp in the documentation.
To realize a good table inheritance you have to define a table for each class and **each** class have to identified by a discriminator. Therefore we added the BoTyp.GESCHAEFTSOBJEKT to the BoTyp enumeration.
* 🐛 Change type from geschaeftspartnerrolle and kontaktweg to List
* ✅ Update tests to List type
kontaktweg and geschaeftspartnerrolle changed to List type
* 🩹 Fix import of Gebiettyp enumeration
Removed the s between tt
* 🎨 Use the same structure for marktrolle like in the other enumerations
* 🩹 Change type of versionstruktur
* 🐛 Change type of versionsstruktur in GeschaeftsobjektSchema to string
* ✅ Update tests to string type of versionstruktur
* 📝 Update gebiettyp enumeration in documentation
* ✅ Update tests to string type of versionstruktur
* 📝🐛 Replace `-` with `_`
Got error in sphinx documentation:
invalid signature for autoattribute ('bo4e.enum.marktrolle::Marktrolle.KUNDE-SELBST-NN')
Co-authored-by: hf-kklein <konstantin.klein@hochfrequenz.de>
Co-authored-by: Annika Schlögl <annika.schloegl@hochfrequenz.de>
Co-authored-by: hf-aschloegl <73470827+hf-aschloegl@users.noreply.github.com>1 parent fbdf087 commit 005ec93
File tree
12 files changed
+60
-54
lines changed- docs/api
- src/bo4e
- bo
- enum
- tests
12 files changed
+60
-54
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
| 55 | + | |
| 56 | + | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | 8 | | |
14 | | - | |
| 9 | + | |
| 10 | + | |
15 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | | - | |
20 | | - | |
21 | 23 | | |
22 | | - | |
23 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
25 | 31 | | |
26 | | - | |
27 | | - | |
28 | 32 | | |
29 | | - | |
30 | | - | |
| 33 | + | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
| 61 | + | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
0 commit comments