Skip to content

Commit 8c05105

Browse files
authored
Added test for GA-sized contest (votingworks#888)
* Added test for GA-sized contest
1 parent 5c15d02 commit 8c05105

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

server/tests/audit_math/test_bravo.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,13 @@ def test_compute_risk(contests):
299299
("cand1", "cand2"): 0.000561,
300300
("cand1", "cand3"): 0,
301301
},
302+
"test_ga_presidential": {
303+
("Biden", "Trump"): 2.035688053599178e-09,
304+
("Biden", "Jorgensen"): 0.0,
305+
("Biden", "Write-in"): 0.0,
306+
("Biden", "Overvote"): 0.0,
307+
("Biden", "Undervote/Blank"): 0.0,
308+
},
302309
}
303310

304311
expected_decisions = {
@@ -315,6 +322,7 @@ def test_compute_risk(contests):
315322
"test11": False,
316323
"test12": True,
317324
"test_small_third_candidate": True,
325+
"test_ga_presidential": True,
318326
}
319327

320328
for contest in contests.values():
@@ -353,6 +361,13 @@ def test_compute_risk_empty(contests):
353361
"test11": {("cand1", "cand2"): 1,},
354362
"test12": {("cand1", "cand2"): 1, ("cand1", "cand3"): 1,},
355363
"test_small_third_candidate": {("cand1", "cand2"): 1, ("cand1", "cand3"): 1,},
364+
"test_ga_presidential": {
365+
("Biden", "Trump"): 1,
366+
("Biden", "Jorgensen"): 1,
367+
("Biden", "Write-in"): 1,
368+
("Biden", "Overvote"): 1,
369+
("Biden", "Undervote/Blank"): 1,
370+
},
356371
}
357372

358373
expected_decisions = {
@@ -369,6 +384,7 @@ def test_compute_risk_empty(contests):
369384
"test11": False,
370385
"test12": False,
371386
"test_small_third_candidate": False,
387+
"test_ga_presidential": False,
372388
}
373389

374390
for contest in contests.values():
@@ -513,6 +529,17 @@ def test_tied_contest():
513529
"votesAllowed": 1,
514530
"numWinners": 1,
515531
},
532+
"test_ga_presidential": {
533+
"Trump": 2457924,
534+
"Biden": 2471981,
535+
"Jorgensen": 62058,
536+
"Write-in": 457,
537+
"Overvote": 0,
538+
"Undervote/Blank": 0,
539+
"ballots": 4992420,
540+
"votesAllowed": 1,
541+
"numWinners": 1,
542+
},
516543
}
517544

518545
# Useful test data
@@ -530,6 +557,7 @@ def test_tied_contest():
530557
"test11": None,
531558
"test12": None,
532559
"test_small_third_candidate": None,
560+
"test_ga_presidential": None,
533561
}
534562

535563
round1_sample_results = {
@@ -548,6 +576,16 @@ def test_tied_contest():
548576
"test_small_third_candidate": {
549577
"round1": {"cand1": 1200, "cand2": 1000, "cand3": 10}
550578
},
579+
"test_ga_presidential": {
580+
"round1": {
581+
"Trump": 2457924,
582+
"Biden": 2471971, # Take 10 away to make the sample "fewer" ballots
583+
"Jorgensen": 62058,
584+
"Write-in": 457,
585+
"Overvote": 0,
586+
"Undervote/Blank": 0,
587+
}
588+
},
551589
}
552590

553591
true_sample_sizes = {
@@ -594,4 +632,10 @@ def test_tied_contest():
594632
"0.8": {"type": None, "size": 3760, "prob": 0.8},
595633
"0.9": {"type": None, "size": 5426, "prob": 0.9},
596634
},
635+
"test_ga_presidential": {
636+
"asn": {"type": "ASN", "size": 573956, "prob": 0.5},
637+
"0.7": {"type": None, "size": 930691, "prob": 0.7},
638+
"0.8": {"type": None, "size": 1233334, "prob": 0.8},
639+
"0.9": {"type": None, "size": 1780697, "prob": 0.9},
640+
},
597641
}

0 commit comments

Comments
 (0)