itag test coverage
Browse files- tests/test_query.py +7 -8
tests/test_query.py
CHANGED
|
@@ -32,22 +32,21 @@ def test_filters(test_input, expected, gangnam_style):
|
|
| 32 |
assert result == expected
|
| 33 |
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
|
| 39 |
-
def
|
| 40 |
-
assert
|
| 41 |
|
| 42 |
|
| 43 |
def test_get_first(gangnam_style):
|
| 44 |
assert gangnam_style.streams.first().itag == '22'
|
| 45 |
|
| 46 |
|
| 47 |
-
def test_get_first_empty_results(gangnam_style):
|
| 48 |
-
assert not gangnam_style.streams.filter(video_codec='vp20').first()
|
| 49 |
-
|
| 50 |
-
|
| 51 |
def test_order_by(gangnam_style):
|
| 52 |
itags = [
|
| 53 |
s.itag for s in gangnam_style.streams
|
|
|
|
| 32 |
assert result == expected
|
| 33 |
|
| 34 |
|
| 35 |
+
@pytest.mark.parametrize('test_input', ['first', 'last'])
|
| 36 |
+
def test_empty(test_input, gangnam_style):
|
| 37 |
+
query = gangnam_style.streams.filter(video_codec='vp20')
|
| 38 |
+
fn = getattr(query, test_input)
|
| 39 |
+
assert fn() is None
|
| 40 |
|
| 41 |
|
| 42 |
+
def test_get_last(gangnam_style):
|
| 43 |
+
assert gangnam_style.streams.last().itag == '251'
|
| 44 |
|
| 45 |
|
| 46 |
def test_get_first(gangnam_style):
|
| 47 |
assert gangnam_style.streams.first().itag == '22'
|
| 48 |
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
def test_order_by(gangnam_style):
|
| 51 |
itags = [
|
| 52 |
s.itag for s in gangnam_style.streams
|