-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Csv export refinement #90
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5d331c9
Pretty printing for lists of integers.
vteague 62d5289
Merge remote-tracking branch 'origin/main' into csvExportRefinement
vteague 3b0f196
Merge branch 'main' into csvExportRefinement
vteague 289859b
Remove warnings in tests.
vteague 4f5149a
Merge remote-tracking branch 'origin/csvExportRefinement' into csvExp…
vteague File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ the raire assertion generation engine (https://github.com/DemocracyDevelopers/ra | |
* Contests which will be used for validity testing are preloaded into the database using | ||
* src/test/resources/simple_assertions_csv_challenges.sql. | ||
*/ | ||
|
||
@ActiveProfiles("csv-challenges") | ||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||
@AutoConfigureTestDatabase(replace = Replace.NONE) | ||
|
@@ -101,33 +102,32 @@ public void testValidRequestWithNoAssertions() { | |
assertTrue(response.getStatusCode().is2xxSuccessful()); | ||
String output = response.getBody(); | ||
|
||
assertNotNull(output); | ||
assertTrue(output.contains("Contest name, Lots of assertions with ties Contest\n")); | ||
assertTrue(output.contains("Candidates, \"Alice, Bob, Chuan, Diego\"\n\n")); | ||
assertTrue(output.contains("Extreme item, Value, Assertion IDs")); | ||
assertTrue(output.contains("Margin, 220, \"2, 5, 6\"")); | ||
assertTrue(output.contains("Diluted margin, 0.22, \"2, 5, 6\"")); | ||
assertTrue(output.contains("Raire difficulty, 3.1, 3")); | ||
assertTrue(output.contains("Current risk, 0.23, \"2, 3\"")); | ||
assertTrue(output.contains("Optimistic samples to audit, 910, 4")); | ||
assertTrue(output.contains("Estimated samples to audit, 430, \"2, 5\"\n\n")); | ||
assertTrue(output.contains("Contest name,Lots of assertions with ties Contest\n")); | ||
assertTrue(output.contains("Candidates,\"Alice,Bob,Chuan,Diego\"\n\n")); | ||
assertTrue(output.contains("Extreme item,Value,Assertion IDs")); | ||
assertTrue(output.contains("Margin,220,\"2, 5, 6\"")); | ||
assertTrue(output.contains("Diluted margin,0.22,\"2, 5, 6\"")); | ||
assertTrue(output.contains("Raire difficulty,3.1,\"3\"")); | ||
assertTrue(output.contains("Current risk,0.23,\"2, 3\"")); | ||
assertTrue(output.contains("Optimistic samples to audit,910,\"4\"")); | ||
assertTrue(output.contains("Estimated samples to audit,430,\"2, 5\"\n\n")); | ||
assertTrue(output.contains( | ||
"ID, Type, Winner, Loser, Assumed continuing, Difficulty, Margin, Diluted margin, Risk, " | ||
+ "Estimated samples to audit, Optimistic samples to audit, Two vote over count, " | ||
+ "One vote over count, Other discrepancy count, One vote under count, " | ||
"ID,Type,Winner,Loser,Assumed continuing,Difficulty,Margin,Diluted margin,Risk," | ||
+ "Estimated samples to audit,Optimistic samples to audit,Two vote over count," | ||
+ "One vote over count,Other discrepancy count,One vote under count," | ||
+ "Two vote under count\n" | ||
)); | ||
assertTrue(output.contains("1, NEB, Alice, Bob, , 2.1, 320, 0.32, 0.04, 110, 100, 0, 0, 0, 0, 0\n")); | ||
assertTrue(output.contains("2, NEB, Chuan, Bob, , 1.1, 220, 0.22, 0.23, 430, 200, 0, 0, 0, 0, 0\n")); | ||
assertTrue(output.contains("3, NEB, Diego, Chuan, , 3.1, 320, 0.32, 0.23, 50, 110, 0, 0, 0, 0, 0\n")); | ||
assertTrue(output.contains("1,NEB,Alice,Bob,,2.1,320,0.32,0.04,110,100,0,0,0,0,0\n")); | ||
assertTrue(output.contains("2,NEB,Chuan,Bob,,1.1,220,0.22,0.23,430,200,0,0,0,0,0\n")); | ||
assertTrue(output.contains("3,NEB,Diego,Chuan,,3.1,320,0.32,0.23,50,110,0,0,0,0,0\n")); | ||
assertTrue(output.contains( | ||
"4, NEN, Alice, Bob, \"Alice, Bob, Chuan\", 2.0, 420, 0.42, 0.04, 320, 910, 0, 0, 0, 0, 0\n" | ||
"4,NEN,Alice,Bob,\"Alice,Bob,Chuan\",2.0,420,0.42,0.04,320,910,0,0,0,0,0\n" | ||
)); | ||
assertTrue(output.contains( | ||
"5, NEN, Alice, Diego, \"Alice, Diego\", 1.1, 220, 0.22, 0.07, 430, 210, 0, 0, 0, 0, 0\n" | ||
"5,NEN,Alice,Diego,\"Alice,Diego\",1.1,220,0.22,0.07,430,210,0,0,0,0,0\n" | ||
)); | ||
assertTrue(output.contains( | ||
"6, NEN, Alice, Bob, \"Alice, Bob, Diego\", 1.2, 220, 0.22, 0.04, 400, 110, 0, 0, 0, 0, 0\n" | ||
"6,NEN,Alice,Bob,\"Alice,Bob,Diego\",1.2,220,0.22,0.04,400,110,0,0,0,0,0\n" | ||
)); | ||
} | ||
|
||
|
@@ -170,24 +170,23 @@ public void testCSVDemoContest() { | |
ResponseEntity<String> response = restTemplate.postForEntity(url, request, String.class); | ||
String output = response.getBody(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add "assertNotNull(output);" to avoid warning about NullPointerException. |
||
|
||
assertNotNull(output); | ||
assertTrue(output.contains("Contest name, CSV Demo Contest\n")); | ||
assertTrue(output.contains("Candidates, \"Alice, Bob, Chuan, Diego\"\n\n")); | ||
assertTrue(output.contains("Extreme item, Value, Assertion IDs\n")); | ||
assertTrue(output.contains("Margin, 100, 2\n")); | ||
assertTrue(output.contains("Diluted margin, 0.1, 2\n")); | ||
assertTrue(output.contains("Raire difficulty, 6.1, 2\n")); | ||
assertTrue(output.contains("Current risk, 0.06, 1\n")); | ||
assertTrue(output.contains("Optimistic samples to audit, 45, 2\n")); | ||
assertTrue(output.contains("Estimated samples to audit, 55, 1\n")); | ||
assertTrue(output.contains("Contest name,CSV Demo Contest\n")); | ||
assertTrue(output.contains("Candidates,\"Alice,Bob,Chuan,Diego\"\n\n")); | ||
assertTrue(output.contains("Extreme item,Value,Assertion IDs\n")); | ||
assertTrue(output.contains("Margin,100,\"2\"\n")); | ||
assertTrue(output.contains("Diluted margin,0.1,\"2\"\n")); | ||
assertTrue(output.contains("Raire difficulty,6.1,\"2\"\n")); | ||
assertTrue(output.contains("Current risk,0.06,\"1\"\n")); | ||
assertTrue(output.contains("Optimistic samples to audit,45,\"2\"\n")); | ||
assertTrue(output.contains("Estimated samples to audit,55,\"1\"\n")); | ||
assertTrue(output.contains( | ||
"ID, Type, Winner, Loser, Assumed continuing, Difficulty, Margin, Diluted margin, Risk, " | ||
+ "Estimated samples to audit, Optimistic samples to audit, Two vote over count, " | ||
+ "One vote over count, Other discrepancy count, One vote under count, " | ||
"ID,Type,Winner,Loser,Assumed continuing,Difficulty,Margin,Diluted margin,Risk," | ||
+ "Estimated samples to audit,Optimistic samples to audit,Two vote over count," | ||
+ "One vote over count,Other discrepancy count,One vote under count," | ||
+ "Two vote under count\n")); | ||
assertTrue(output.contains("1, NEB, Bob, Alice, , 5.1, 112, 0.112, 0.06, 55, 35, 0, 2, 0, 0, 0\n")); | ||
assertTrue(output.contains("1,NEB,Bob,Alice,,5.1,112,0.112,0.06,55,35,0,2,0,0,0\n")); | ||
assertTrue(output.contains( | ||
"2, NEN, Diego, Chuan, \"Alice, Chuan, Diego\", 6.1, 100, 0.1, 0.05, 45, 45, 0, 0, 0, 0, 0\n" | ||
"2,NEN,Diego,Chuan,\"Alice,Chuan,Diego\",6.1,100,0.1,0.05,45,45,0,0,0,0,0\n" | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add "assertNotNull(output);" to avoid the warning about the NullPointerException.