Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions tests/cte/test_cte.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,35 @@
from xsdata.formats.dataclass.serializers.config import SerializerConfig

from nfelib.cte.bindings import v4_0 # noqa: F401
from nfelib.cte.bindings.v4_0.cte_tipos_basico_v4_00 import Tcte, TcteOs, TcteSimp


class CTeTests(TestCase):
def test_patched_xsdata_for_ibscsb(self):
# see https://github.com/akretion/nfelib/pull/151
# IBSCBS should be TtribCte, not str
assert (
str(Tcte.InfCte.Imp().__annotations__["IBSCBS"])
== "typing.Optional[nfelib.cte.bindings.v4_0.dfe_tipos_basicos_v1_00.TtribCte]"
# Python < 3.9:
or str(Tcte.InfCte.Imp().__annotations__["IBSCBS"])
== "typing.Union[nfelib.cte.bindings.v4_0.dfe_tipos_basicos_v1_00.TtribCte, NoneType]"
)
assert (
str(TcteOs.InfCte.Imp().__annotations__["IBSCBS"])
== "typing.Optional[nfelib.cte.bindings.v4_0.dfe_tipos_basicos_v1_00.TtribCte]"
# Python < 3.9:
or str(TcteOs.InfCte.Imp().__annotations__["IBSCBS"])
== "typing.Union[nfelib.cte.bindings.v4_0.dfe_tipos_basicos_v1_00.TtribCte, NoneType]"
)
assert (
str(TcteSimp.InfCte.Imp().__annotations__["IBSCBS"])
== "typing.Optional[nfelib.cte.bindings.v4_0.dfe_tipos_basicos_v1_00.TtribCte]"
# Python < 3.9:
or str(TcteSimp.InfCte.Imp().__annotations__["IBSCBS"])
== "typing.Union[nfelib.cte.bindings.v4_0.dfe_tipos_basicos_v1_00.TtribCte, NoneType]"
)

def test_in_out_cte(self):
path = os.path.join("nfelib", "cte", "samples", "v4_0")
for filename in os.listdir(path):
Expand Down
Loading