fix test_playlist.test_title
Browse files
tests/contrib/test_playlist.py
CHANGED
@@ -1,10 +1,16 @@
|
|
1 |
# -*- coding: utf-8 -*-
|
|
|
|
|
2 |
from pytube import Playlist
|
3 |
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
8 |
pl = Playlist(url)
|
9 |
pl_title = pl.title()
|
10 |
-
assert pl_title == "Python Tutorial for Beginners"
|
|
|
1 |
# -*- coding: utf-8 -*-
|
2 |
+
from unittest import mock
|
3 |
+
|
4 |
from pytube import Playlist
|
5 |
|
6 |
|
7 |
+
@mock.patch("pytube.contrib.playlist.request.get")
|
8 |
+
def test_title(request_get):
|
9 |
+
request_get.return_value = (
|
10 |
+
"<title>(149) Python Tutorial for Beginners "
|
11 |
+
"(For Absolute Beginners) - YouTube</title>"
|
12 |
+
)
|
13 |
+
url = "https://www.fakeurl.com/playlist?list=PLsyeobzWxl7poL9JTVyndKe62ieoN"
|
14 |
pl = Playlist(url)
|
15 |
pl_title = pl.title()
|
16 |
+
assert pl_title == "(149) Python Tutorial for Beginners (For Absolute Beginners)"
|