Skip to content

Commit

Permalink
add simple test to parse a file
Browse files Browse the repository at this point in the history
  • Loading branch information
phoughton committed May 25, 2024
1 parent 10612a8 commit dc25651
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions tests/my_test.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import pytest
from myproj import myclass
from xsdata.formats.dataclass.parsers import XmlParser
from pyiso20022.pain.pain_001_001_08 import *


@pytest.mark.parametrize("a_var", [
(1),
(2),
(3)
@pytest.mark.parametrize("expected_postcode", [
("052")
])
def test_myclass(a_var):
my_obj = myclass.MyClass(a_var)
assert my_obj.get_my_var() == a_var
assert my_obj.myvar == a_var
def test_parse_pain001_001_008(expected_postcode):

parser = XmlParser()

with open("example_files/gs_pain/pain001_001_08.xml", "rb") as xml_file:
doc: Document = parser.parse(xml_file, Document, )

post_code = doc.cstmr_cdt_trf_initn.pmt_inf[0].dbtr.pstl_adr.pst_cd

assert post_code == expected_postcode

0 comments on commit dc25651

Please # to comment.