47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
from admin_analytics.irs990.parser import parse_xml, parse_filing, parse_part_vii, parse_schedule_j
|
|
|
|
|
|
def test_parse_filing(fixtures_dir):
|
|
root = parse_xml(fixtures_dir / "990_sample.xml")
|
|
filing = parse_filing(root)
|
|
assert filing["ein"] == "516000297"
|
|
assert filing["tax_year"] == 2022
|
|
assert filing["organization_name"] == "UNIVERSITY OF DELAWARE"
|
|
assert filing["return_type"] == "990"
|
|
assert filing["total_revenue"] == 1800000000
|
|
assert filing["total_expenses"] == 1700000000
|
|
assert filing["total_assets"] == 5000000000
|
|
|
|
|
|
def test_parse_part_vii(fixtures_dir):
|
|
root = parse_xml(fixtures_dir / "990_sample.xml")
|
|
people = parse_part_vii(root)
|
|
assert len(people) == 3
|
|
|
|
president = people[0]
|
|
assert president["person_name"] == "JOHN DOE"
|
|
assert president["title"] == "PRESIDENT"
|
|
assert president["avg_hours_per_week"] == 40.0
|
|
assert president["reportable_comp_from_org"] == 850000
|
|
|
|
trustee = people[2]
|
|
assert trustee["person_name"] == "BOB JONES"
|
|
assert trustee["title"] == "TRUSTEE"
|
|
assert trustee["reportable_comp_from_org"] == 0
|
|
|
|
|
|
def test_parse_schedule_j(fixtures_dir):
|
|
root = parse_xml(fixtures_dir / "990_sample.xml")
|
|
people = parse_schedule_j(root)
|
|
assert len(people) == 2
|
|
|
|
president = people[0]
|
|
assert president["person_name"] == "JOHN DOE"
|
|
assert president["base_compensation"] == 700000
|
|
assert president["bonus_compensation"] == 100000
|
|
assert president["deferred_compensation"] == 75000
|
|
assert president["total_compensation"] == 950000
|
|
|
|
vp = people[1]
|
|
assert vp["person_name"] == "JANE SMITH"
|
|
assert vp["total_compensation"] == 520000
|