ElectionDataAnalysis / electiondata

Tools for consolidation and analysis of raw election results from the most reliable sources -- the election agencies themselves.
Other
20 stars 5 forks source link

Examine automated tests #741

Closed sfsinger19103 closed 2 years ago

sfsinger19103 commented 2 years ago

From JOSS review (suggestion, not requirement):

I've uploaded logs of my pytest runs (again, on Windows) here: https://gist.github.com/vaneseltine/d493a9741d8319b6bec7ddc94b19e112

I'm not sure what the issue with dataloading_tests is -- it fails 1 test on an assertion about receiving the correct files. analyzer_tests looks like it's getting tripped up on exact float requirements, and so fails 3 tests on the score due to inequalities like 2.3758572130853186 != 2.375857213085318 No problems with jurisdiction_prepper_tests Nothing too alarming, but I wanted to provide you these logs for reference. #2 is probably another issue that boils down to a difference in platform/OS but it's worth considering a test strategy that will make a "close enough" comparison. pytest.approx() is designed to do this, but it can't work on large mixed-type dicts like the ones being compared there, so it's not a drop-in solution for you.

sfsinger19103 commented 2 years ago

Sample failure -- the problem is that the test requires too much precision in comparing percentages:

================================== FAILURES ===================================
___________________________ test_bar_congressional ____________________________

analyzer = <electiondata.Analyzer object at 0x000001D8FE026040>

    def test_bar_congressional(analyzer):
>       assert (
            analyzer.bar(
                "2018 General", "Georgia", "Congressional", "US House GA District 3"
            )
            == results.ga_2018_bar_congressional
        )
E       AssertionError: assert [{'ballot_types': 'Georgia provides data by vote type',\n  'contest': 'US House GA District 3',\n  'count_item_type': 'election-day',\n  'counts': [{'name': 'Georgia;Henry County',\n              'x': 5735.0,\n              'x_pct': 0.5978940783986656,\n              'y': 3857.0,\n              'y_pct': 0.40210592160133446},\n             {'name': 'Georgia;Meriwether County',\n              'x': 2090.0,\n              'x_pct': 0.40053660406285935,\n              'y': 3128.0,\n              'y_pct': 0.5994633959371407},\n             {'name': 'Georgia;Troup County',\n              'x': 4079.0,\n              'x_pct': 0.3724773993242626,\n              'y': 6872.0,\n              'y_pct': 0.6275226006757374},\n             {'name': 'Georgia;Spalding County',\n              'x': 3578.0,\n              'x_pct': 0.36365484297184675,\n              'y': 6261.0,\n              'y_pct': 0.6363451570281533},\n             {'name': 'Georgia;Upson County',\n              'x': 1116.0,\n              'x_pct': 0.3513853904282116,\n              'y': 2060.0,\n              'y_pct': 0.6486146095717884},\n             {'name': 'Georgia;Fayette County',\n              'x': 6666.0,\n              'x_pct': 0.34398059755405336,\n              'y': 12713.0,\n              'y_pct': 0.6560194024459467},\n             {'name': 'Georgia;Muscogee County',\n              'x': 2812.0,\n              'x_pct': 0.2854822335025381,\n              'y': 7038.0,\n              'y_pct': 0.7145177664974619},\n             {'name': 'Average of all others',\n              'x': 2744.8333333333335,\n              'x_pct': 0.25041053399829705,\n              'y': 8216.5,\n              'y_pct': 0.749589466001703}],\n  'election': '2018 General',\n  'jurisdiction': 'Georgia',\n  'margin': '91,000',\n  'margin_raw': 90986,\n  'preliminary': False,\n  'score': 2.954547891007076,\n  'subdivision_type': 'county',\n  'title': 'Election Day Ballots Reported',\n  'votes_at_stake': 'Outlier narrowed margin by ~ 4,000',\n  'votes_at_stake_raw': -3788,\n  'x': 'Chuck Enderlin (D)',\n  'y': 'Drew Ferguson (R)'},\n {'ballot_types': 'Georgia provides data by vote type',\n  'contest': 'US House GA District 3',\n  'count_item_type': 'early',\n  'counts': [{'name': 'Georgia;Henry County',\n              'x': 9964.0,\n              'x_pct': 0.5745588744089494,\n              'y': 7378.0,\n              'y_pct': 0.42544112559105063},\n             {'name': 'Georgia;Muscogee County',\n              'x': 2657.0,\n              'x_pct': 0.3921771217712177,\n              'y': 4118.0,\n              'y_pct': 0.6078228782287823},\n             {'name': 'Georgia;Fayette County',\n              'x': 9754.0,\n              'x_pct': 0.3844243881291136,\n              'y': 15619.0,\n              'y_pct': 0.6155756118708864},\n             {'name': 'Georgia;Meriwether County',\n              'x': 1029.0,\n              'x_pct': 0.37014388489208633,\n              'y': 1751.0,\n              'y_pct': 0.6298561151079136},\n             {'name': 'Georgia;Spalding County',\n              'x': 4606.0,\n              'x_pct': 0.3610566747667947,\n              'y': 8151.0,\n              'y_pct': 0.6389433252332053},\n             {'name': 'Georgia;Troup County',\n              'x': 3842.0,\n              'x_pct': 0.3472523499638467,\n              'y': 7222.0,\n              'y_pct': 0.6527476500361533},\n             {'name': 'Georgia;Carroll County',\n              'x': 6055.0,\n              'x_pct': 0.30539163766580923,\n              'y': 13772.0,\n              'y_pct': 0.6946083623341908},\n             {'name': 'Average of all others',\n              'x': 2170.5,\n              'x_pct': 0.26741822214008504,\n              'y': 5946.0,\n              'y_pct': 0.732581777859915}],\n  'election': '2018 General',\n  'jurisdiction': 'Georgia',\n  'margin': '91,000',\n  'margin_raw': 90986,\n  'preliminary': False,\n  'score': 2.73849296214817,\n  'subdivision_type': 'county',\n  'title': 'Early Ballots Reported',\n  'votes_at_stake': 'Outlier narrowed margin by ~ 6,000',\n  'votes_at_stake_raw': -6326,\n  'x': 'Chuck Enderlin (D)',\n  'y': 'Drew Ferguson (R)'},\n {'ballot_types': 'Georgia provides data by vote type',\n  'contest': 'US House GA District 3',\n  'count_item_type': 'total',\n  'counts': [{'name': 'Georgia;Henry County',\n              'x': 16852.0,\n              'x_pct': 0.5901800098059816,\n              'y': 11702.0,\n              'y_pct': 0.4098199901940183},\n             {'name': 'Georgia;Meriwether County',\n              'x': 3428.0,\n              'x_pct': 0.4041023222916421,\n              'y': 5055.0,\n              'y_pct': 0.5958976777083579},\n             {'name': 'Georgia;Fayette County',\n              'x': 17527.0,\n              'x_pct': 0.3742446565455982,\n              'y': 29306.0,\n              'y_pct': 0.6257553434544018},\n             {'name': 'Georgia;Spalding County',\n              'x': 8919.0,\n              'x_pct': 0.37366458586451046,\n              'y': 14950.0,\n              'y_pct': 0.6263354141354895},\n             {'name': 'Georgia;Troup County',\n              'x': 8690.0,\n              'x_pct': 0.3698029703391634,\n              'y': 14809.0,\n              'y_pct': 0.6301970296608367},\n             {'name': 'Georgia;Muscogee County',\n              'x': 5906.0,\n              'x_pct': 0.3357780430951163,\n              'y': 11683.0,\n              'y_pct': 0.6642219569048837},\n             {'name': 'Georgia;Upson County',\n              'x': 3326.0,\n              'x_pct': 0.32014630859563,\n              'y': 7063.0,\n              'y_pct': 0.67985369140437},\n             {'name': 'Average of all others',\n              'x': 6060.333333333333,\n              'x_pct': 0.27178413932281936,\n              'y': 16238.0,\n              'y_pct': 0.7282158606771807}],\n  'election': '2018 General',\n  'jurisdiction': 'Georgia',\n  'margin': '91,000',\n  'margin_raw': 90986,\n  'preliminary': False,\n  'score': 2.796871322532087,\n  'subdivision_type': 'county',\n  'title': 'Total Ballots Reported',\n  'votes_at_stake': 'Outlier narrowed margin by ~ 11,000',\n  'votes_at_stake_raw': -10628,\n  'x': 'Chuck Enderlin (D)',\n  'y': 'Drew Ferguson (R)'}] == [{'ballot_types': 'Georgia provides data by vote type',\n  'contest': 'US House GA District 3',\n  'count_item_type': 'election-day',\n  'counts': [{'name': 'Georgia;Henry County',\n              'x': 5735.0,\n              'x_pct': 0.5978940783986656,\n              'y': 3857.0,\n              'y_pct': 0.40210592160133446},\n             {'name': 'Georgia;Meriwether County',\n              'x': 2090.0,\n              'x_pct': 0.40053660406285935,\n              'y': 3128.0,\n              'y_pct': 0.5994633959371407},\n             {'name': 'Georgia;Troup County',\n              'x': 4079.0,\n              'x_pct': 0.3724773993242626,\n              'y': 6872.0,\n              'y_pct': 0.6275226006757374},\n             {'name': 'Georgia;Spalding County',\n              'x': 3578.0,\n              'x_pct': 0.36365484297184675,\n              'y': 6261.0,\n              'y_pct': 0.6363451570281533},\n             {'name': 'Georgia;Upson County',\n              'x': 1116.0,\n              'x_pct': 0.3513853904282116,\n              'y': 2060.0,\n              'y_pct': 0.6486146095717884},\n             {'name': 'Georgia;Fayette County',\n              'x': 6666.0,\n              'x_pct': 0.34398059755405336,\n              'y': 12713.0,\n              'y_pct': 0.6560194024459467},\n             {'name': 'Georgia;Muscogee County',\n              'x': 2812.0,\n              'x_pct': 0.2854822335025381,\n              'y': 7038.0,\n              'y_pct': 0.7145177664974619},\n             {'name': 'Average of all others',\n              'x': 2744.8333333333335,\n              'x_pct': 0.25041053399829705,\n              'y': 8216.5,\n              'y_pct': 0.749589466001703}],\n  'election': '2018 General',\n  'jurisdiction': 'Georgia',\n  'margin': '91,000',\n  'margin_raw': 90986,\n  'preliminary': False,\n  'score': 2.954547891007076,\n  'subdivision_type': 'county',\n  'title': 'Election Day Ballots Reported',\n  'votes_at_stake': 'Outlier narrowed margin by ~ 4,000',\n  'votes_at_stake_raw': -3788,\n  'x': 'Chuck Enderlin (D)',\n  'y': 'Drew Ferguson (R)'},\n {'ballot_types': 'Georgia provides data by vote type',\n  'contest': 'US House GA District 3',\n  'count_item_type': 'early',\n  'counts': [{'name': 'Georgia;Henry County',\n              'x': 9964.0,\n              'x_pct': 0.5745588744089494,\n              'y': 7378.0,\n              'y_pct': 0.42544112559105063},\n             {'name': 'Georgia;Muscogee County',\n              'x': 2657.0,\n              'x_pct': 0.3921771217712177,\n              'y': 4118.0,\n              'y_pct': 0.6078228782287823},\n             {'name': 'Georgia;Fayette County',\n              'x': 9754.0,\n              'x_pct': 0.3844243881291136,\n              'y': 15619.0,\n              'y_pct': 0.6155756118708864},\n             {'name': 'Georgia;Meriwether County',\n              'x': 1029.0,\n              'x_pct': 0.37014388489208633,\n              'y': 1751.0,\n              'y_pct': 0.6298561151079136},\n             {'name': 'Georgia;Spalding County',\n              'x': 4606.0,\n              'x_pct': 0.3610566747667947,\n              'y': 8151.0,\n              'y_pct': 0.6389433252332053},\n             {'name': 'Georgia;Troup County',\n              'x': 3842.0,\n              'x_pct': 0.3472523499638467,\n              'y': 7222.0,\n              'y_pct': 0.6527476500361533},\n             {'name': 'Georgia;Carroll County',\n              'x': 6055.0,\n              'x_pct': 0.30539163766580923,\n              'y': 13772.0,\n              'y_pct': 0.6946083623341908},\n             {'name': 'Average of all others',\n              'x': 2170.5,\n              'x_pct': 0.26741822214008504,\n              'y': 5946.0,\n              'y_pct': 0.732581777859915}],\n  'election': '2018 General',\n  'jurisdiction': 'Georgia',\n  'margin': '91,000',\n  'margin_raw': 90986,\n  'preliminary': False,\n  'score': 2.7384929621481704,\n  'subdivision_type': 'county',\n  'title': 'Early Ballots Reported',\n  'votes_at_stake': 'Outlier narrowed margin by ~ 6,000',\n  'votes_at_stake_raw': -6326,\n  'x': 'Chuck Enderlin (D)',\n  'y': 'Drew Ferguson (R)'},\n {'ballot_types': 'Georgia provides data by vote type',\n  'contest': 'US House GA District 3',\n  'count_item_type': 'total',\n  'counts': [{'name': 'Georgia;Henry County',\n              'x': 16852.0,\n              'x_pct': 0.5901800098059816,\n              'y': 11702.0,\n              'y_pct': 0.4098199901940183},\n             {'name': 'Georgia;Meriwether County',\n              'x': 3428.0,\n              'x_pct': 0.4041023222916421,\n              'y': 5055.0,\n              'y_pct': 0.5958976777083579},\n             {'name': 'Georgia;Fayette County',\n              'x': 17527.0,\n              'x_pct': 0.3742446565455982,\n              'y': 29306.0,\n              'y_pct': 0.6257553434544018},\n             {'name': 'Georgia;Spalding County',\n              'x': 8919.0,\n              'x_pct': 0.37366458586451046,\n              'y': 14950.0,\n              'y_pct': 0.6263354141354895},\n             {'name': 'Georgia;Troup County',\n              'x': 8690.0,\n              'x_pct': 0.3698029703391634,\n              'y': 14809.0,\n              'y_pct': 0.6301970296608367},\n             {'name': 'Georgia;Muscogee County',\n              'x': 5906.0,\n              'x_pct': 0.3357780430951163,\n              'y': 11683.0,\n              'y_pct': 0.6642219569048837},\n             {'name': 'Georgia;Upson County',\n              'x': 3326.0,\n              'x_pct': 0.32014630859563,\n              'y': 7063.0,\n              'y_pct': 0.67985369140437},\n             {'name': 'Average of all others',\n              'x': 6060.333333333333,\n              'x_pct': 0.27178413932281936,\n              'y': 16238.0,\n              'y_pct': 0.7282158606771807}],\n  'election': '2018 General',\n  'jurisdiction': 'Georgia',\n  'margin': '91,000',\n  'margin_raw': 90986,\n  'preliminary': False,\n  'score': 2.796871322532087,\n  'subdivision_type': 'county',\n  'title': 'Total Ballots Reported',\n  'votes_at_stake': 'Outlier narrowed margin by ~ 11,000',\n  'votes_at_stake_raw': -10628,\n  'x': 'Chuck Enderlin (D)',\n  'y': 'Drew Ferguson (R)'}]
E         At index 1 diff: {'jurisdiction': 'Georgia', 'x': 'Chuck Enderlin (D)', 'y': 'Drew Ferguson (R)', 'counts': [{'name': 'Georgia;Henry County', 'x': 9964.0, 'y': 7378.0, 'x_pct': 0.5745588744089494, 'y_pct': 0.42544112559105063}, {'name': 'Georgia;Muscogee County', 'x': 2657.0, 'y': 4118.0, 'x_pct': 0.3921771217712177, 'y_pct': 0.6078228782287823}, {'name': 'Georgia;Fayette County', 'x': 9754.0, 'y': 15619.0, 'x_pct': 0.3844243881291136, 'y_pct': 0.6155756118708864}, {'name': 'Georgia;Meriwether County', 'x': 1029.0, 'y': 1751.0, 'x_pct': 0.37014388489208633, 'y_pct': 0.6298561151079136}, {'name': 'Georgia;Spalding County', 'x': 4606.0, 'y': 8151.0, 'x_pct': 0.3610566747667947, 'y_pct': 0.6389433252332053}, {'name': 'Georgia;Troup County', 'x': 3842.0, 'y': 7222.0, 'x_pct': 0.3472523499638467, 'y_pct': 0.6527476500361533}, {'name': 'Georgia;Carroll County', 'x': 6055.0, 'y': 13772.0, 'x_pct': 0.30539163766580923, 'y_pct': 0.6946083623341908}, {'name': 'Average of all others', 'x': 2170.5, 'y': 5946.0, 'x_pct': 0.26741822214008504, 'y_pct': 0.732581777859915}], 'election': '2018 General', 'contest': 'US House GA District 3', 'subdivision_type': 'county', 'count_item_type': 'early', 'votes_at_stake_raw': -6326, 'margin_raw': 90986, 'votes_at_stake': 'Outlier narrowed margin by ~ 6,000', 'margin': '91,000', 'preliminary': False, 'ballot_types': 'Georgia provides data by vote type', 'score': 2.73849296214817, 'title': 'Early Ballots Reported'} != {'jurisdiction': 'Georgia', 'x': 'Chuck Enderlin (D)', 'y': 'Drew Ferguson (R)', 'counts': [{'name': 'Georgia;Henry County', 'x': 9964.0, 'y': 7378.0, 'x_pct': 0.5745588744089494, 'y_pct': 0.42544112559105063}, {'name': 'Georgia;Muscogee County', 'x': 2657.0, 'y': 4118.0, 'x_pct': 0.3921771217712177, 'y_pct': 0.6078228782287823}, {'name': 'Georgia;Fayette County', 'x': 9754.0, 'y': 15619.0, 'x_pct': 0.3844243881291136, 'y_pct': 0.6155756118708864}, {'name': 'Georgia;Meriwether County', 'x': 1029.0, 'y': 1751.0, 'x_pct': 0.37014388489208633, 'y_pct': 0.6298561151079136}, {'name': 'Georgia;Spalding County', 'x': 4606.0, 'y': 8151.0, 'x_pct': 0.3610566747667947, 'y_pct': 0.6389433252332053}, {'name': 'Georgia;Troup County', 'x': 3842.0, 'y': 7222.0, 'x_pct': 0.3472523499638467, 'y_pct': 0.6527476500361533}, {'name': 'Georgia;Carroll County', 'x': 6055.0, 'y': 13772.0, 'x_pct': 0.30539163766580923, 'y_pct': 0.6946083623341908}, {'name': 'Average of all others', 'x': 2170.5, 'y': 5946.0, 'x_pct': 0.26741822214008504, 'y_pct': 0.732581777859915}], 'election': '2018 General', 'contest': 'US House GA District 3', 'subdivision_type': 'county', 'count_item_type': 'early', 'votes_at_stake_raw': -6326, 'margin_raw': 90986, 'votes_at_stake': 'Outlier narrowed margin by ~ 6,000', 'margin': '91,000', 'ballot_types': 'Georgia provides data by vote type', 'score': 2.7384929621481704, 'title': 'Early Ballots Reported', 'preliminary': False}
E         Full diff:
E           [
E            {'ballot_types': 'Georgia provides data by vote type',
E             'contest': 'US House GA District 3',
E             'count_item_type': 'election-day',
E             'counts': [{'name': 'Georgia;Henry County',
E                         'x': 5735.0,
E                         'x_pct': 0.5978940783986656,
E                         'y': 3857.0,
E                         'y_pct': 0.40210592160133446},
E                        {'name': 'Georgia;Meriwether County',
E                         'x': 2090.0,
E                         'x_pct': 0.40053660406285935,
E                         'y': 3128.0,
E                         'y_pct': 0.5994633959371407},
E                        {'name': 'Georgia;Troup County',
E                         'x': 4079.0,
E                         'x_pct': 0.3724773993242626,
E                         'y': 6872.0,
E                         'y_pct': 0.6275226006757374},
E                        {'name': 'Georgia;Spalding County',
E                         'x': 3578.0,
E                         'x_pct': 0.36365484297184675,
E                         'y': 6261.0,
E                         'y_pct': 0.6363451570281533},
E                        {'name': 'Georgia;Upson County',
E                         'x': 1116.0,
E                         'x_pct': 0.3513853904282116,
E                         'y': 2060.0,
E                         'y_pct': 0.6486146095717884},
E                        {'name': 'Georgia;Fayette County',
E                         'x': 6666.0,
E                         'x_pct': 0.34398059755405336,
E                         'y': 12713.0,
E                         'y_pct': 0.6560194024459467},
E                        {'name': 'Georgia;Muscogee County',
E                         'x': 2812.0,
E                         'x_pct': 0.2854822335025381,
E                         'y': 7038.0,
E                         'y_pct': 0.7145177664974619},
E                        {'name': 'Average of all others',
E                         'x': 2744.8333333333335,
E                         'x_pct': 0.25041053399829705,
E                         'y': 8216.5,
E                         'y_pct': 0.749589466001703}],
E             'election': '2018 General',
E             'jurisdiction': 'Georgia',
E             'margin': '91,000',
E             'margin_raw': 90986,
E             'preliminary': False,
E             'score': 2.954547891007076,
E             'subdivision_type': 'county',
E             'title': 'Election Day Ballots Reported',
E             'votes_at_stake': 'Outlier narrowed margin by ~ 4,000',
E             'votes_at_stake_raw': -3788,
E             'x': 'Chuck Enderlin (D)',
E             'y': 'Drew Ferguson (R)'},
E            {'ballot_types': 'Georgia provides data by vote type',
E             'contest': 'US House GA District 3',
E             'count_item_type': 'early',
E             'counts': [{'name': 'Georgia;Henry County',
E                         'x': 9964.0,
E                         'x_pct': 0.5745588744089494,
E                         'y': 7378.0,
E                         'y_pct': 0.42544112559105063},
E                        {'name': 'Georgia;Muscogee County',
E                         'x': 2657.0,
E                         'x_pct': 0.3921771217712177,
E                         'y': 4118.0,
E                         'y_pct': 0.6078228782287823},
E                        {'name': 'Georgia;Fayette County',
E                         'x': 9754.0,
E                         'x_pct': 0.3844243881291136,
E                         'y': 15619.0,
E                         'y_pct': 0.6155756118708864},
E                        {'name': 'Georgia;Meriwether County',
E                         'x': 1029.0,
E                         'x_pct': 0.37014388489208633,
E                         'y': 1751.0,
E                         'y_pct': 0.6298561151079136},
E                        {'name': 'Georgia;Spalding County',
E                         'x': 4606.0,
E                         'x_pct': 0.3610566747667947,
E                         'y': 8151.0,
E                         'y_pct': 0.6389433252332053},
E                        {'name': 'Georgia;Troup County',
E                         'x': 3842.0,
E                         'x_pct': 0.3472523499638467,
E                         'y': 7222.0,
E                         'y_pct': 0.6527476500361533},
E                        {'name': 'Georgia;Carroll County',
E                         'x': 6055.0,
E                         'x_pct': 0.30539163766580923,
E                         'y': 13772.0,
E                         'y_pct': 0.6946083623341908},
E                        {'name': 'Average of all others',
E                         'x': 2170.5,
E                         'x_pct': 0.26741822214008504,
E                         'y': 5946.0,
E                         'y_pct': 0.732581777859915}],
E             'election': '2018 General',
E             'jurisdiction': 'Georgia',
E             'margin': '91,000',
E             'margin_raw': 90986,
E             'preliminary': False,
E         -   'score': 2.7384929621481704,
E         ?                            --
E         +   'score': 2.73849296214817,
E             'subdivision_type': 'county',
E             'title': 'Early Ballots Reported',
E             'votes_at_stake': 'Outlier narrowed margin by ~ 6,000',
E             'votes_at_stake_raw': -6326,
E             'x': 'Chuck Enderlin (D)',
E             'y': 'Drew Ferguson (R)'},
E            {'ballot_types': 'Georgia provides data by vote type',
E             'contest': 'US House GA District 3',
E             'count_item_type': 'total',
E             'counts': [{'name': 'Georgia;Henry County',
E                         'x': 16852.0,
E                         'x_pct': 0.5901800098059816,
E                         'y': 11702.0,
E                         'y_pct': 0.4098199901940183},
E                        {'name': 'Georgia;Meriwether County',
E                         'x': 3428.0,
E                         'x_pct': 0.4041023222916421,
E                         'y': 5055.0,
E                         'y_pct': 0.5958976777083579},
E                        {'name': 'Georgia;Fayette County',
E                         'x': 17527.0,
E                         'x_pct': 0.3742446565455982,
E                         'y': 29306.0,
E                         'y_pct': 0.6257553434544018},
E                        {'name': 'Georgia;Spalding County',
E                         'x': 8919.0,
E                         'x_pct': 0.37366458586451046,
E                         'y': 14950.0,
E                         'y_pct': 0.6263354141354895},
E                        {'name': 'Georgia;Troup County',
E                         'x': 8690.0,
E                         'x_pct': 0.3698029703391634,
E                         'y': 14809.0,
E                         'y_pct': 0.6301970296608367},
E                        {'name': 'Georgia;Muscogee County',
E                         'x': 5906.0,
E                         'x_pct': 0.3357780430951163,
E                         'y': 11683.0,
E                         'y_pct': 0.6642219569048837},
E                        {'name': 'Georgia;Upson County',
E                         'x': 3326.0,
E                         'x_pct': 0.32014630859563,
E                         'y': 7063.0,
E                         'y_pct': 0.67985369140437},
E                        {'name': 'Average of all others',
E                         'x': 6060.333333333333,
E                         'x_pct': 0.27178413932281936,
E                         'y': 16238.0,
E                         'y_pct': 0.7282158606771807}],
E             'election': '2018 General',
E             'jurisdiction': 'Georgia',
E             'margin': '91,000',
E             'margin_raw': 90986,
E             'preliminary': False,
E             'score': 2.796871322532087,
E             'subdivision_type': 'county',
E             'title': 'Total Ballots Reported',
E             'votes_at_stake': 'Outlier narrowed margin by ~ 11,000',
E             'votes_at_stake_raw': -10628,
E             'x': 'Chuck Enderlin (D)',
E             'y': 'Drew Ferguson (R)'},
E           ]
sfsinger19103 commented 2 years ago

Could resolve by having pct calculation restrict to, say, 3 significant digits, and revising test data

sfsinger19103 commented 2 years ago

Closed in #743