-
Notifications
You must be signed in to change notification settings - Fork 44
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
Adding test_parse_file_with_missing_index_on_first_line #81
Adding test_parse_file_with_missing_index_on_first_line #81
Conversation
Thanks! The concept is fine, but please use a Hypothesis test instead of using a file fixture :-) See |
I'm also up for adding support to parse SRT files without an index, by the way. Those subtitles can get index=None, which can then be handled by to_srt() and the comparison checks. |
I adapted the test to use
I'll let you handle that 😊 |
Thanks! I see you pushed a new commit. But I guess I was asking why do the loop over |
To be clear, this is what I'm wondering about (untested):
|
I adopted the version of the code that you suggested. |
Sorry for another round of review, but I'm confused again. Why I promise we're getting somewhere with this PR, I'm just confused at the changes from the suggested code :-) |
I am simply not very familiar with
Because the |
Ah, for that, pass |
Ok, done! |
Looks like tests failed because black format check failed. Want me to just rebase and fix up? Otherwise feel free to run https://github.com/cdown/srt/runs/5382080756?check_suite_focus=true |
I prettified the code with |
Yeah sure, I just wasn't sure if you'd prefer I just blacken the code and fix it up myself without your intervention (although that won't show as "merged" on GitHub UI). I'll run CI and merge. Thanks! |
Thanks again! |
And thanks again for bringing this general case up, 745d5ee now supports it officially. |
My original problem had already been spotted in #51:
some
.srt
files I found do not contain any initial index for the first block.Hence I started working on adding support to the
srt
lib for parsing those files,but I realized that it works totally fine with
srt.parse(subs, ignore_errors=True)
.Hence this PR only adds an explicit unit test,
to make
srt
behaviour for those kind of files explicit.