File: test_data.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 (18 lines) | stat: -rw-r--r-- 615 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import pytest

from streamlink.utils.data import search_dict


@pytest.mark.parametrize(
    ("args", "expected"),
    [
        ((["one", "two"], "one"), []),
        (({"two": "test2"}, "one"), []),
        (({"one": "test1", "two": "test2"}, "one"), ["test1"]),
        (({"one": {"inner": "test1"}, "two": "test2"}, "inner"), ["test1"]),
        (({"one": [{"inner": "test1"}], "two": "test2"}, "inner"), ["test1"]),
        (({"one": [{"inner": "test1"}], "two": {"inner": "test2"}}, "inner"), ["test1", "test2"]),
    ],
)
def test_search_dict(args, expected):
    assert list(search_dict(*args)) == expected