Skip to content

Commit 59ff1d3

Browse files
committed
more README tweaks
1 parent 15df5a6 commit 59ff1d3

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ place for some of the data transforms and computations that now live in _lib/par
162162
* margin of victory, if appropriate
163163

164164
Before we dive into migrating data transforms and computed values, let's start with the basics.
165-
We'll store our new election classes in a *lib/models.py* ([Django[] users, this should be familiar).
165+
We'll store our new election classes in a *lib/models.py* ([Django][] users, this should be familiar).
166166
We'll store tests in a new *test_models.py* module.
167167

168168
[Django]: https://docs.djangoproject.com/en/dev/topics/db/models
@@ -182,7 +182,7 @@ Now let's start writing some test-driven code!
182182
#### Add name bits
183183

184184
We'll start by creating a Candidate class that automatically parses a full name into first and last names (remember,
185-
candidate names in our source data are in the form *Lastname, Firstname*).
185+
candidate names in our source data are in the form *(Lastname, Firstname*).
186186

187187
* Create *elex4/tests/test_models.py* and add test for Candidate name parts ([elex4.1.0][])
188188
* Run test; see it fail
@@ -200,7 +200,7 @@ Let's apply a similar process for the party transformation.
200200

201201
#### Add party
202202

203-
The candidate party requires special handling for Democratics and Republicans. Otherwise we'll default to the raw party value.
203+
The candidate party requires special handling for Democrats and Republicans. Otherwise we'll default to the raw party value.
204204

205205
* Migrate party-related tests from *tests/test_parser.py* to *TestCandidate* in *tests/test_models.py*.
206206

@@ -252,22 +252,22 @@ converting from a function-based to a class-based strategy hasn't corrupted the
252252

253253
### Add vote
254254

255-
Each candidate has a single name and party, and numerous county-level results.
255+
In addition to a name and party, each *Candidate* has county-level results.
256256
As part of our summary report, county-level results need to be rolled up into a racewide total for each candidate.
257257
At a high level, it seems natural for each candidate to track his or her own vote totals.
258258

259-
Below are a few other basic assumptions, or requirements, that will help us flesh out
260-
vote-handling on the Candidate class:
259+
Below are a few basic assumptions, or requirements, that will help us flesh out
260+
vote-handling on the *Candidate* class:
261261

262262
* A candidate should start with zero votes
263263
* Adding a vote should increment the vote count
264264
* County-level results should be accessible
265265

266266
With this basic list of requirements in hand, we're ready to start coding. For each requirement, we'll start by
267-
writing a (failing) test that captures this assumption; then we'll write code to make the test pass. The goal
268-
is to capture our assumptions in the form of tests, and then write code to meet those assumnptions.
267+
writing a (failing) test that captures this assumption; then we'll write code to make the test pass (i.e. meet
268+
our assumption).
269269

270-
1. Add test for zero vote count as initial Candidate state ([elex4.3.0][])
270+
1. Add test to ensure *Candidate*'s initial vote count is zero ([elex4.3.0][])
271271

272272
> Note: We created a new *TestCandidateVotes* class with a *setUp* method that lets us
273273
> re-use the same candidate instance across all test methods. This
@@ -277,12 +277,20 @@ is to capture our assumptions in the form of tests, and then write code to meet
277277
> we will have to do in the *TestCandidate* class)
278278
279279
1. Run test; see it fail
280-
1. Update Candidate to have initial vote count of zero ([elex4.3.1][])
280+
1. Update *Candidate* class to have initial vote count of zero ([elex4.3.1][])
281281
1. Run test; see it pass
282+
283+
Now let's add a method to update the candidate's total vote totals for each county result.
284+
282285
1. Add test for *Candidate.add_votes* method ([elex4.3.2][])
283286
1. Run test; see it fail
284287
1. Create the *Candidate.add_votes* method ([elex4.3.3][])
285288
1. Run test; see it pass
289+
290+
Finally, let's stash the county-level results for each candidate.
291+
Although we're not using these lower-level numbers in our summary report, it's easy enough to
292+
add in case we need it for some other use case down the road.
293+
286294
1. Create test for county_results attribute ([elex4.3.4][])
287295
1. Run test; see it fail
288296
1. Update *Candidate.add_votes* method to store county-level results ([elex4.3.5][])

0 commit comments

Comments
 (0)