mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-12-23 04:30:10 +09:00
[test_utils] Fix expand_path tests
This commit is contained in:
parent
d212c93d16
commit
41c5e60dd5
@ -218,11 +218,16 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertEqual(sanitize_path('./../abc'), '..\\abc')
|
self.assertEqual(sanitize_path('./../abc'), '..\\abc')
|
||||||
|
|
||||||
def test_expand_path(self):
|
def test_expand_path(self):
|
||||||
|
def env(var):
|
||||||
|
return '%{0}%'.format(var) if sys.platform == 'win32' else '${0}'.format(var)
|
||||||
|
|
||||||
compat_setenv('YOUTUBE-DL-EXPATH-PATH', 'expanded')
|
compat_setenv('YOUTUBE-DL-EXPATH-PATH', 'expanded')
|
||||||
self.assertEqual(expand_path('%YOUTUBE-DL-EXPATH-PATH%'), 'expanded')
|
self.assertEqual(expand_path(env('YOUTUBE-DL-EXPATH-PATH')), 'expanded')
|
||||||
self.assertEqual(expand_path('%HOMEPATH%'), compat_getenv('HOMEPATH'))
|
self.assertEqual(expand_path(env('HOMEPATH')), compat_getenv('HOMEPATH'))
|
||||||
self.assertEqual(expand_path('~'), compat_getenv('HOME'))
|
self.assertEqual(expand_path('~'), compat_getenv('HOME'))
|
||||||
self.assertEqual(expand_path('~/%YOUTUBE-DL-EXPATH-PATH%'), '%s/expanded' % compat_getenv('HOME'))
|
self.assertEqual(
|
||||||
|
expand_path('~/%s' % env('YOUTUBE-DL-EXPATH-PATH')),
|
||||||
|
'%s/expanded' % compat_getenv('HOME'))
|
||||||
|
|
||||||
def test_prepend_extension(self):
|
def test_prepend_extension(self):
|
||||||
self.assertEqual(prepend_extension('abc.ext', 'temp'), 'abc.temp.ext')
|
self.assertEqual(prepend_extension('abc.ext', 'temp'), 'abc.temp.ext')
|
||||||
|
Loading…
Reference in New Issue
Block a user