-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Erreichbarkeit #885
base: main
Are you sure you want to change the base?
Add Erreichbarkeit #885
Changes from all commits
4375855
83bec5c
e16e1db
82d5198
df3db29
ac1aaf5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
Contains Erreichbarkeit class and corresponding marshmallow schema for de-/serialization | ||
""" | ||
|
||
# pylint: disable=too-few-public-methods, too-many-instance-attributes | ||
# pylint: disable=no-name-in-module | ||
|
||
from typing import Optional | ||
|
||
from ..com.zeitfenster import Zeitfenster | ||
from ..utils import postprocess_docstring | ||
from .com import COM | ||
|
||
|
||
@postprocess_docstring | ||
class Erreichbarkeit(COM): | ||
""" | ||
Eine Komponente zur Abbildung der Erreichbarkeit | ||
|
||
.. raw:: html | ||
|
||
<object data="../_static/images/bo4e/com/Erreichbarkeit.svg" type="image/svg+xml"></object> | ||
|
||
.. HINT:: | ||
`Erreichbarkeit JSON Schema <https://json-schema.app/view/%23?url=https://raw.githubusercontent.com/BO4E/BO4E-Schemas/{__gh_version__}/src/bo4e_schemas/com/Erreichbarkeit.json>`_ | ||
|
||
""" | ||
|
||
montag_erreichbarkeit: Optional[Zeitfenster] = None | ||
|
||
dienstag_erreichbarkeit: Optional[Zeitfenster] = None | ||
|
||
mittwoch_erreichbarkeit: Optional[Zeitfenster] = None | ||
|
||
donnerstag_erreichbarkeit: Optional[Zeitfenster] = None | ||
|
||
freitag_erreichbarkeit: Optional[Zeitfenster] = None | ||
|
||
mittagspause: Optional[Zeitfenster] = None |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
Contains Zeitfenster class and corresponding marshmallow schema for de-/serialization | ||
""" | ||
|
||
# pylint: disable=too-few-public-methods, too-many-instance-attributes | ||
# pylint: disable=no-name-in-module | ||
|
||
from datetime import time | ||
from typing import Optional | ||
|
||
from ..utils import postprocess_docstring | ||
from .com import COM | ||
|
||
|
||
@postprocess_docstring | ||
class Zeitfenster(COM): | ||
""" | ||
Eine Komponente zur Abbildung des Zeitfensters für die Erreichbarkeit | ||
|
||
.. raw:: html | ||
|
||
<object data="../_static/images/bo4e/com/Zeitfenster.svg" type="image/svg+xml"></object> | ||
|
||
.. HINT:: | ||
`Zeitfenster JSON Schema <https://json-schema.app/view/%23?url=https://raw.githubusercontent.com/BO4E/BO4E-Schemas/{__gh_version__}/src/bo4e_schemas/com/Zeitfenster.json>`_ | ||
|
||
""" | ||
|
||
startzeit: Optional[time] = None | ||
endzeit: Optional[time] = None | ||
Comment on lines
+29
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. kannst du einen test hinzufügen, wie das serialisiert wird? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. der scheint probleme haben das auf github mit der Time funktion zu encode Lokal läuft das durch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also was mich interessiert ist: sieht 17uhr hier in python gleich aus wie 17uhr drüben in c#? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. der scheint probleme haben das auf github mit der Time funktion zu encode
@lord-haffi weiß vllt mehr. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Die neuen Modelle müssen der init.py hinzugefügt werden There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lord-haffi es ligt nicht daraan das es nicht in der init war |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from datetime import time, timezone | ||
|
||
import pytest | ||
|
||
from bo4e.com.erreichbarkeit import Erreichbarkeit | ||
from bo4e.com.zeitfenster import Zeitfenster | ||
from tests.serialization_helper import assert_serialization_roundtrip | ||
|
||
|
||
class TestErreichbarkeit: | ||
@pytest.mark.parametrize( | ||
"erreichbarkeit", | ||
[ | ||
pytest.param( | ||
Erreichbarkeit( | ||
montag_erreichbarkeit=Zeitfenster( | ||
startzeit=time(8, 00, tzinfo=timezone.utc), endzeit=time(17, 00, tzinfo=timezone.utc) | ||
), | ||
dienstag_erreichbarkeit=Zeitfenster( | ||
startzeit=time(8, 00, tzinfo=timezone.utc), endzeit=time(17, 00, tzinfo=timezone.utc) | ||
), | ||
mittwoch_erreichbarkeit=Zeitfenster( | ||
startzeit=time(8, 00, tzinfo=timezone.utc), endzeit=time(17, 00, tzinfo=timezone.utc) | ||
), | ||
donnerstag_erreichbarkeit=Zeitfenster( | ||
startzeit=time(8, 00, tzinfo=timezone.utc), endzeit=time(17, 00, tzinfo=timezone.utc) | ||
), | ||
freitag_erreichbarkeit=Zeitfenster( | ||
startzeit=time(8, 00, tzinfo=timezone.utc), endzeit=time(17, 00, tzinfo=timezone.utc) | ||
), | ||
mittagspause=Zeitfenster( | ||
startzeit=time(12, 00, tzinfo=timezone.utc), endzeit=time(13, 00, tzinfo=timezone.utc) | ||
), | ||
), | ||
), | ||
], | ||
) | ||
def test_serialization_roundtrip(self, erreichbarkeit: Erreichbarkeit) -> None: | ||
""" | ||
Test de-/serialisation of Erreichbarkeit. | ||
""" | ||
assert_serialization_roundtrip(erreichbarkeit) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from datetime import time, timezone | ||
|
||
import pytest | ||
|
||
from bo4e.com.zeitfenster import Zeitfenster | ||
from tests.serialization_helper import assert_serialization_roundtrip | ||
|
||
|
||
class TestZeitfenster: | ||
@pytest.mark.parametrize( | ||
"zeitfenster", | ||
[ | ||
pytest.param( | ||
Zeitfenster( | ||
startzeit=time(8, 00, tzinfo=timezone.utc), | ||
endzeit=time(17, 00, tzinfo=timezone.utc), | ||
), | ||
), | ||
], | ||
) | ||
def test_serialization_roundtrip(self, zeitfenster: Zeitfenster) -> None: | ||
""" | ||
Test de-/serialisation of Zeitfenster. | ||
""" | ||
assert_serialization_roundtrip(zeitfenster) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Die Erreichbarkeit und auch auch die Bankverbindung und Steuernummer gerne noch im Geschäftspartner-Test ergänzen. Fällt nur nicht auf, weil alles optional ist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e16e1db