Clean up get_chapters code and expand tests #97
Merged
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.
@Enkidu93 For the first section, I thought my original error messages didn't make a ton of sense, so I rewrote and combined them. I also updated the
BOOK_RANGE
andCHAPTER_SELECTION
regexes to allow subtraction so that I could take out the subtraction check right before.I also decided to just take out the ability to add "chapter 0" because I don't think anyone's using it and it's inconsistent since adding the whole book doesn't include chapter 0, like we talked about.
I kept whole books being represented as an empty list because it's much more convenient that way for silnlp. Otherwise, we'd have to pass a versification variable through all the different functions just to be able to check chapter counts.
Other than that, I fixed the stuff for backwards ranges and added your test cases. Let me know if you have more thoughts or if I missed something!
This change is