Skip to content

Commit 92f1816

Browse files
committed
tests: ensure proper types for IS and IBSCBS
1 parent 74d6be7 commit 92f1816

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/nfe/test_nfe.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,26 @@ def test_patched_xsdata_for_ipi(self):
3737
== "typing.Union[nfelib.nfe.bindings.v4_0.leiaute_nfe_v4_00.Tipi, NoneType]"
3838
)
3939

40+
def test_patched_xsdata_for_is(self):
41+
# see https://github.com/akretion/nfelib/pull/134
42+
assert (
43+
str(Tnfe.InfNfe.Det.Imposto().__annotations__["IS"])
44+
== "typing.Optional[nfelib.nfe.bindings.v4_0.dfe_tipos_basicos_v1_00.Tis]"
45+
# Python < 3.9:
46+
or str(Tnfe.InfNfe.Det.Imposto().__annotations__["IS"])
47+
== "typing.Union[nfelib.nfe.bindings.v4_0.dfe_tipos_basicos_v1_00.Tis, NoneType]"
48+
)
49+
50+
def test_patched_xsdata_for_ibscsb(self):
51+
# see https://github.com/akretion/nfelib/pull/134
52+
assert (
53+
str(Tnfe.InfNfe.Det.Imposto().__annotations__["IBSCBS"])
54+
== "typing.Optional[nfelib.nfe.bindings.v4_0.dfe_tipos_basicos_v1_00.TtribNfe]"
55+
# Python < 3.9:
56+
or str(Tnfe.InfNfe.Det.Imposto().__annotations__["IBSCBS"])
57+
== "typing.Union[nfelib.nfe.bindings.v4_0.dfe_tipos_basicos_v1_00.TtribNfe, NoneType]"
58+
)
59+
4060
def test_sign(self):
4161
path = os.path.join("nfelib", "nfe", "samples", "v4_0", "leiauteNFe")
4262
filename = "42210775277525000178550030000266631762885493-procNFe.xml"

0 commit comments

Comments
 (0)