(offset)
| 69 | |
| 70 | @pytest.mark.parametrize("offset", [1, 1.5, -2.3]) |
| 71 | def test_offset(offset): |
| 72 | parser = GenericSubtitleParser() |
| 73 | offseter = SubtitleShifter(offset) |
| 74 | pipe = make_pipeline(parser, offseter) |
| 75 | pipe.fit(BytesIO(fake_srt)) |
| 76 | for sub_orig, sub_offset in zip(parser.subs_, offseter.subs_): |
| 77 | assert ( |
| 78 | abs( |
| 79 | sub_offset.start.total_seconds() |
| 80 | - sub_orig.start.total_seconds() |
| 81 | - offset |
| 82 | ) |
| 83 | < 1e-6 |
| 84 | ) |
| 85 | assert ( |
| 86 | abs(sub_offset.end.total_seconds() - sub_orig.end.total_seconds() - offset) |
| 87 | < 1e-6 |
| 88 | ) |
| 89 | |
| 90 | |
| 91 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected