Refactor Enum Construction (for better IDE Support)#71
Conversation
hf-krechan
left a comment
There was a problem hiding this comment.
Nice approach with this str-enum class =)
| strategy: | ||
| matrix: | ||
| python-version: [3.9] | ||
| python-version: ["3.10"] |
There was a problem hiding this comment.
oha living the future ^^
| on: | ||
| push: | ||
| branches: [ develop, master ] | ||
| branches: [develop, master] |
There was a problem hiding this comment.
Do you have a yaml formatter now?
There was a problem hiding this comment.
prettier does yaml, too
| matrix: | ||
| python-version: [ 3.8 ] | ||
| os: [ ubuntu-latest ] | ||
| python-version: [3.8] |
There was a problem hiding this comment.
Why is here only Python v3.8?
| SONSTIGES_GERAET = "SONSTIGES_GERAET" # Sonstiges Gerät | ||
| PREPAYMENTZAEHLER = "PREPAYMENTZAEHLER" # Prepaymentzähler | ||
| EDL_21 = "EDL_21" # EDL21 | ||
| _96_H_ZAEHLER = "96_H_ZAEHLER" # 96 h Zähler |
There was a problem hiding this comment.
Is this a legit variable name?
| An enum that has string values. | ||
| """ | ||
|
|
||
| # see https://docs.python.org/3/library/enum.html?highlight=strenum#others |
There was a problem hiding this comment.
👍 nice thanks for this link
| json_string = schema.dumps(ansprechpartner, ensure_ascii=False) | ||
| assert "Müller-Schmidt" in json_string | ||
| assert "Mühlenweg" in json_string | ||
| assert '"FRAU"' in json_string |
There was a problem hiding this comment.
I thought there should be just FRAU without the quotes.
There was a problem hiding this comment.
nope. because to json, the enum just behaves like a normal string (or int). only when the json is deserialized into something type it becomes an enum value.
fixes #48

implies #70