1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00
svtplay-dl/lib/svtplay_dl/tests/test_stream.py
2019-09-07 12:28:51 +02:00

30 lines
980 B
Python

import unittest
from svtplay_dl.fetcher.dash import DASH
from svtplay_dl.fetcher.hls import HLS
from svtplay_dl.fetcher.http import HTTP
from svtplay_dl.utils.parser import setup_defaults
from svtplay_dl.utils.stream import sort_quality
class streamTest_sort(unittest.TestCase):
def test_sort(self):
data = [
DASH(setup_defaults(), "http://example.com", 3000),
HLS(setup_defaults(), "http://example.com", 2000),
HTTP(setup_defaults(), "http://example.com", 3001),
]
assert all(
[
a[0] == b.bitrate
for a, b in zip(
sort_quality(data),
[
HTTP(setup_defaults(), "http://example.com", 3001),
DASH(setup_defaults(), "http://example.com", 3000),
HLS(setup_defaults(), "http://example.com", 2000),
],
)
]
)