2019-09-07 12:28:51 +02:00
|
|
|
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 = [
|
2020-07-29 20:44:25 +02:00
|
|
|
DASH(setup_defaults(), "http://example.com", 3000, None),
|
|
|
|
HLS(setup_defaults(), "http://example.com", 2000, None),
|
|
|
|
HTTP(setup_defaults(), "http://example.com", 3001, None),
|
2019-09-07 12:28:51 +02:00
|
|
|
]
|
|
|
|
assert all(
|
|
|
|
[
|
|
|
|
a[0] == b.bitrate
|
|
|
|
for a, b in zip(
|
|
|
|
sort_quality(data),
|
|
|
|
[
|
2020-07-29 20:44:25 +02:00
|
|
|
HTTP(setup_defaults(), "http://example.com", 3001, None),
|
|
|
|
DASH(setup_defaults(), "http://example.com", 3000, None),
|
|
|
|
HLS(setup_defaults(), "http://example.com", 2000, None),
|
2019-09-07 12:28:51 +02:00
|
|
|
],
|
|
|
|
)
|
2020-12-26 13:10:56 +01:00
|
|
|
],
|
2019-09-07 12:28:51 +02:00
|
|
|
)
|