File: test_segmented.py

package info (click to toggle)
streamlink 8.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,564 kB
  • sloc: python: 51,188; sh: 184; makefile: 152
file content (40 lines) | stat: -rw-r--r-- 1,137 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import pytest

from streamlink.stream.segmented.segment import Segment
from streamlink.stream.segmented.segmented import log


def test_logger_name():
    assert log.name == "streamlink.stream.segmented"


@pytest.mark.parametrize(
    ("data", "expected"),
    [
        pytest.param(
            dict(
                num=1,
                init=False,
                discontinuity=False,
                uri="/path/to/segment.ts?query#fragment",
                duration=4.0,
            ),
            "Segment(num=1, init=False, discontinuity=False, duration=4.000, fileext='ts')",
            id="with-fileext",
        ),
        pytest.param(
            dict(
                num=1,
                init=False,
                discontinuity=False,
                uri="/path/to/segment.other?query#fragment",
                duration=4.0,
            ),
            "Segment(num=1, init=False, discontinuity=False, duration=4.000, fileext=None)",
            id="without-fileext",
        ),
    ],
)
def test_segment_serialization(data: dict, expected: str):
    segment = Segment(**data)
    assert repr(segment) == expected