File size: 775 Bytes
f7e59f8 a97679f f7e59f8 e707f93 f7e59f8 25de36d e7518ec 82321d6 e707f93 a97679f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# -*- coding: utf-8 -*-
from pytube.exceptions import VideoUnavailable, RegexMatchError, LiveStreamError
def test_video_unavailable():
try:
raise VideoUnavailable(video_id="YLnZklYFe7E")
except VideoUnavailable as e:
assert e.video_id == "YLnZklYFe7E"
assert str(e) == "YLnZklYFe7E is unavailable"
def test_regex_match_error():
try:
raise RegexMatchError(caller="hello", pattern="*")
except RegexMatchError as e:
assert str(e) == "hello: could not find match for *"
def test_live_stream_error():
try:
raise LiveStreamError(video_id="YLnZklYFe7E")
except LiveStreamError as e:
assert e.video_id == "YLnZklYFe7E"
assert str(e) == "YLnZklYFe7E is streaming live and cannot be loaded"
|