Refactors and adds tests for split_file_by_parts.

This includes changing the signature to match split_file_by_lines.

Refactors testing code for split_file_by_lines to reduce code
redundancy.

Also changes assert_has_calls to assertEqual, because assert_has_calls
actually passes if the expected calls are a subset of the actual calls,
wheras I wanted to test that the actual calls were exactly as expected,
including the number of calls. Interesting gotcha.