mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-07-05 04:26:18 -07:00
[compat] Use compat_open()
This commit is contained in:
parent
aac33155e4
commit
a25e9f3c84
16 changed files with 68 additions and 55 deletions
|
@ -8,11 +8,14 @@ import sys
|
|||
import unittest
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
import io
|
||||
import re
|
||||
import string
|
||||
|
||||
from youtube_dl.compat import compat_str, compat_urlretrieve
|
||||
from youtube_dl.compat import (
|
||||
compat_open as open,
|
||||
compat_str,
|
||||
compat_urlretrieve,
|
||||
)
|
||||
|
||||
from test.helper import FakeYDL
|
||||
from youtube_dl.extractor import YoutubeIE
|
||||
|
@ -208,7 +211,7 @@ def t_factory(name, sig_func, url_pattern):
|
|||
|
||||
if not os.path.exists(fn):
|
||||
compat_urlretrieve(url, fn)
|
||||
with io.open(fn, encoding='utf-8') as testf:
|
||||
with open(fn, encoding='utf-8') as testf:
|
||||
jscode = testf.read()
|
||||
self.assertEqual(sig_func(jscode, sig_input), expected_sig)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue