File size: 528 Bytes
e7964fa 3e182e5 e7964fa 3e182e5 e7964fa 82321d6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# -*- coding: utf-8 -*-
import pytest
from pytube import helpers
from pytube.exceptions import RegexMatchError
def test_regex_search_no_match():
with pytest.raises(RegexMatchError):
helpers.regex_search("^a$", "", group=0)
def test_regex_search():
assert helpers.regex_search("^a$", "a", group=0) == "a"
def test_safe_filename():
"""Unsafe characters get stripped from generated filename"""
assert helpers.safe_filename("abc1245$$") == "abc1245"
assert helpers.safe_filename("abc##") == "abc"
|