forked from pytube/pytube
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
10 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
# -*- coding: utf-8 -*- | ||
from unittest import mock | ||
|
||
from pytube import Playlist | ||
|
||
|
||
def test_title(): | ||
list_key = "PLsyeobzWxl7poL9JTVyndKe62ieoN-MZ3" | ||
url = "https://www.youtube.com/playlist?list=" + list_key | ||
@mock.patch("pytube.contrib.playlist.request.get") | ||
def test_title(request_get): | ||
request_get.return_value = ( | ||
"<title>(149) Python Tutorial for Beginners " | ||
"(For Absolute Beginners) - YouTube</title>" | ||
) | ||
url = "https://www.fakeurl.com/playlist?list=PLsyeobzWxl7poL9JTVyndKe62ieoN" | ||
pl = Playlist(url) | ||
pl_title = pl.title() | ||
assert pl_title == "Python Tutorial for Beginners" | ||
assert pl_title == "(149) Python Tutorial for Beginners (For Absolute Beginners)" |