diff --git a/atst/eda_client.py b/atst/eda_client.py index b6376682..f4a2f2b6 100644 --- a/atst/eda_client.py +++ b/atst/eda_client.py @@ -28,14 +28,14 @@ class EDAXMLHandler: def _line_items(self): return self.element_tree.findall(".//LineItem[LineItemType='CLIN']/../../..") - def _parse_clin_data(self): - for line_item in self._line_items: - number = line_item.find(".//LineItemBase").text - amount_details = line_item.find(".//ItemOtherAmounts[AmountDescription='Not to Exceed Amount (Funding)']/Amount") - self.clins[number] = float(amount_details.text) - def parse(self): - self._parse_clin_data() + for line_item in self._line_items: + number_el = line_item.find(".//LineItemBase") + amount_details = line_item.find( + ".//ItemOtherAmounts[AmountDescription='Not to Exceed Amount (Funding)']/Amount" + ) + if number_el is not None and amount_details is not None: + self.clins[number_el.text] = float(amount_details.text) class EDAClientBase(object): diff --git a/tests/test_eda_client.py b/tests/test_eda_client.py index 3d8ee3be..005e3037 100644 --- a/tests/test_eda_client.py +++ b/tests/test_eda_client.py @@ -22,5 +22,5 @@ def test_contract_not_found(): def test_eda_xml_parser(): with open("tests/fixtures/eda_contract.xml") as contract: eda_data = parse_eda_xml(contract.read()) - assert eda_data["clin_0001"] == 200000.00 + assert eda_data["clin_0001"] == 200_000.00 assert not eda_data["clin_0003"]