def test_request(self): parsed = fecfile.from_http(1232188) self.assertEqual(parsed['filing']['report_code'], 'M5') self.assertEqual(parsed['filing']['state'], 'NJ') self.assertEqual(len(parsed['itemizations']['Schedule A']), 1) self.assertEqual(len(parsed['itemizations']['Schedule B']), 11) self.assertEqual(len(parsed['text']), 1)
def test_request(self): parsed = fecfile.from_http(1157513) filing = parsed['filing'] comm_name = 'Friends of Dave Brat Inc.' self.assertEqual(filing['committee_name'], comm_name) first_itemization = parsed['itemizations']['Schedule A'][0] self.assertEqual(first_itemization['contribution_amount'], 1500.0)
def test_request(self): parsed = fecfile.from_http(1160672) filing = parsed['filing'] comm_name = '58TH PRESIDENTIAL INAUGURAL COMMITTEE' self.assertEqual(filing['committee_name'], comm_name) first_itemization = parsed['itemizations']['F132'][0] self.assertEqual(first_itemization['donation_amount'], 100.0)
def test_request(self): parsed = fecfile.from_http(52888) filing = parsed['filing'] self.assertEqual(filing['committee_name'], 'KEEGAN 2002') sched_b = parsed['itemizations']['Schedule B'] self.assertEqual(len(sched_b), 55) self.assertEqual(sched_b[0]['expenditure_amount'], 243.84)
def test_request(self): parsed = fecfile.from_http(12888) filing = parsed['filing'] self.assertEqual(filing['committee_name'], 'Defend America PAC') sched_b = parsed['itemizations']['Schedule B'] self.assertEqual(len(sched_b), 6) self.assertEqual(sched_b[0]['expenditure_amount'], 1802.0)
def test_request(self): parsed = fecfile.from_http(130) filing = parsed['filing'] self.assertEqual(filing['filer_committee_id_number'], 'C00252791') sched_b = parsed['itemizations']['Schedule B'] self.assertEqual(len(sched_b), 4) self.assertEqual(sched_b[0]['expenditure_amount'], 286.61)
def test_request(self): parsed = fecfile.from_http(245235) self.assertEqual(parsed['filing']['committee_name'], 'ELECT KEVIN NESTOR TO CONGRESS COMMITTEE') self.assertEqual(parsed['filing']['total_assets'], 93.8) f8ii = parsed['itemizations']['F8II'] self.assertEqual(len(f8ii), 3) self.assertEqual(f8ii[1]['amount_owed_to'], 40000)
def test_request(self): missing_mappings = {} whole_range = list(range(0, 1288000)) random_sample = random.sample(whole_range, 100) for i in random_sample: try: fecfile.from_http(i) except fecfile.FecParserMissingMappingError as ex: print(str(i) + ': ' + str(ex)) relevant_str = str(ex)[13:].split(' - ')[0] if relevant_str in missing_mappings: missing_mappings[relevant_str] += 1 else: missing_mappings[relevant_str] = 1 for m in sorted(missing_mappings.keys()): print('{a} ({b})'.format(a=m, b=missing_mappings[m])) self.assertEqual(len(missing_mappings.keys()), 0)
def test_request(self): parsed = fecfile.from_http(1223458, options={'as_strings': True}) filing = parsed['filing'] self.assertEqual(filing['committee_name'], 'MARGO FOR CONGRESS') self.assertEqual(filing['col_b_total_receipts'], '29916.00') sched_b = parsed['itemizations']['Schedule B'] self.assertEqual(len(sched_b), 5) self.assertEqual(sched_b[0]['expenditure_amount'], '984.00')
def test_request(self): parsed = fecfile.from_http(92888) filing = parsed['filing'] self.assertEqual(filing['committee_name'], 'Mecklenburg County Republican Party') sched_b = parsed['itemizations']['Schedule B'] self.assertEqual(len(sched_b), 5) self.assertEqual(sched_b[0]['expenditure_amount'], 500.0)
def test_request(self): parsed = fecfile.from_http(1090014) self.assertEqual(parsed['header']['fec_version'], '8.1') self.assertEqual( parsed['filing']['committee_name'], 'KENT FOR CONGRESS', ) expected = 'Termination of Campaign. Did not exceed $5000 threshold.' self.assertEqual(parsed['F99_text'], expected)
def test_request(self): parsed = fecfile.from_http(22888) filing = parsed['filing'] self.assertEqual( filing['committee_name'], 'PHOENIX FIRE FIGHTERS, LOCAL 493, FIRE PAC COMMITTEE') sched_b = parsed['itemizations']['Schedule B'] self.assertEqual(len(sched_b), 48) self.assertEqual(sched_b[0]['expenditure_amount'], 250.0)
def test_request(self): parsed = fecfile.from_http(234569) self.assertEqual(parsed['filing']['committee_name'], 'COMMITTEE TO ELECT ALAN GRAYSON') self.assertEqual(parsed['filing']['expenditure_total_cycle_to_date'], 430400) f105 = parsed['itemizations']['F105'] self.assertEqual(len(f105), 2) self.assertEqual(f105[0]['expenditure_amount'], 5400)
def test_request(self): parsed = fecfile.from_http(1226989) filing = parsed['filing'] self.assertEqual(filing['organization_name'], '45Committee, Inc.') self.assertEqual(filing['total_disbursements'], 56678.84) first_91 = parsed['itemizations']['F91'][0] self.assertEqual(first_91['controller_city'], 'Herndon') first_93 = parsed['itemizations']['F93'][0] self.assertEqual(first_93['expenditure_amount'], 48017.00) first_94 = parsed['itemizations']['F94'][0] self.assertEqual(first_94['candidate_last_name'], 'Manchin')
def test_request(self): parsed = fecfile.from_http(1226815) filing = parsed['filing'] self.assertEqual(filing['committee_name'], 'FRIENDS OF MARIA') first_a = parsed['itemizations']['Schedule A'][0] self.assertEqual(first_a['contribution_amount'], 25.0)
def test_request(self): parsed = fecfile.from_http(807197) self.assertEqual(parsed['header']['fec_version'], 'P2.6') self.assertEqual(parsed['filing']['street_1'], '21 NOB HILL DRIVE')
def test_request(self): parsed = fecfile.from_http(99840, {'filter_itemizations': ['SI']}) sched_i = parsed['itemizations']['Schedule I'][0] self.assertEqual(sched_i['col_a_subtotal'], 99592.46)
def test_request(self): parsed = fecfile.from_http(1223616) self.assertEqual(parsed['filing']['committee_name'], 'Leann for Iowa') loan_itemization = parsed['itemizations']['Schedule C'][0] self.assertEqual(loan_itemization['loan_interest_rate_terms'], 'N/A')
def test_request(self): parsed = fecfile.from_http(1160224) filing = parsed['filing'] self.assertEqual(filing['committee_name'], 'BOBBY MAHENDRA FOR SENATE') f3z = parsed['itemizations']['F3Z'] self.assertEqual(f3z[0]['col_a_net_contributions'], 459.75)
def test_request(self): parsed = fecfile.from_http(1229012) sched_c = parsed['itemizations']['Schedule C'][0] self.assertEqual(sched_c['loan_balance'], 30000.00)
def test_request(self): parsed = fecfile.from_http(1235309) self.assertEqual(parsed['header']['fec_version'], '8.2') loan_itemization = parsed['itemizations']['Schedule C'][3] self.assertEqual(loan_itemization['loan_interest_rate'], '5.00%')
def test_request(self): parsed = fecfile.from_http(1146148) self.assertEqual(parsed['filing']['report_code'], 'YE') self.assertEqual(parsed['filing']['state'], 'DC') self.assertEqual(len(parsed['itemizations']['F57']), 5)
def test_request(self): parsed = fecfile.from_http(1156717) summary = parsed['itemizations']['F3S'][0] self.assertEqual(summary['a_total_contributions_no_loans'], 11469.22) self.assertEqual(summary['total_disbursements'], 55324.77)
def test_request(self): parsed = fecfile.from_http(1146147) sched_d = parsed['itemizations']['Schedule D'][0] self.assertEqual(sched_d['balance_at_close_this_period'], 26622.00)
def test_request(self): with warnings.catch_warnings(record=True) as w: parsed = fecfile.from_http(476351) filing = parsed['filing'] self.assertEqual(filing['report_code'], '12P') self.assertEqual(len(w), 0)
def test_request(self): parsed = fecfile.from_http(1229011) self.assertEqual(parsed['header']['fec_version'], '8.2') self.assertEqual(parsed['filing']['treasurer_city'], 'Philadelphia') self.assertIsInstance(parsed['filing']['effective_date'], datetime)
def test_request(self): parsed = fecfile.from_http(1101469) self.assertEqual(parsed['header']['fec_version'], 'P3.2') self.assertEqual(parsed['filing']['city'], 'LUBBOCK') self.assertIsInstance(parsed['filing']['date_signed'], datetime)