catch type errors for non-floats in CLIN amount field
This commit is contained in:
parent
af81cd1da7
commit
d6ec4a5123
@ -35,7 +35,10 @@ class EDAXMLHandler:
|
||||
".//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)
|
||||
try:
|
||||
self.clins[number_el.text] = float(amount_details.text)
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
|
||||
class EDAClientBase(object):
|
||||
|
@ -24,3 +24,34 @@ def test_eda_xml_parser():
|
||||
eda_data = parse_eda_xml(contract.read())
|
||||
assert eda_data["clin_0001"] == 200_000.00
|
||||
assert not eda_data["clin_0003"]
|
||||
|
||||
|
||||
_EDA_XML_NO_NUMBER = """
|
||||
<ProcurementDocument>
|
||||
<AwardInstrument>
|
||||
<ContractLineItems>
|
||||
<LineItems>
|
||||
<LineItemIdentifier>
|
||||
<DFARS>
|
||||
<LineItem>
|
||||
<LineItemType>CLIN</LineItemType>
|
||||
<LineItemBase>0001</LineItemBase>
|
||||
</LineItem>
|
||||
</DFARS>
|
||||
</LineItemIdentifier>
|
||||
<LineItemAmounts>
|
||||
<ItemOtherAmounts>
|
||||
<AmountDescription>Not to Exceed Amount (Funding)</AmountDescription>
|
||||
<Amount>not a number</Amount>
|
||||
</ItemOtherAmounts>
|
||||
</LineItemAmounts>
|
||||
</LineItems>
|
||||
</ContractLineItems>
|
||||
</AwardInstrument>
|
||||
</ProcurementDocument>
|
||||
"""
|
||||
|
||||
|
||||
def test_eda_xml_parser_with_bad_xml():
|
||||
eda_data = parse_eda_xml(_EDA_XML_NO_NUMBER)
|
||||
assert eda_data["clin_0001"] is None
|
||||
|
Loading…
x
Reference in New Issue
Block a user