pytube / tests /test_helpers.py
hbmartin's picture
require group parameter
3e182e5
raw
history blame
528 Bytes
# -*- 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"