def test_expand_path(self):

    def env(var):
        return (f'%{var}%' if (sys.platform == 'win32') else f'${var}')
    compat_setenv('yt_dlp_EXPATH_PATH', 'expanded')
    self.assertEqual(expand_path(env('yt_dlp_EXPATH_PATH')), 'expanded')
    self.assertEqual(expand_path(env('HOME')), compat_getenv('HOME'))
    self.assertEqual(expand_path('~'), compat_getenv('HOME'))
    self.assertEqual(expand_path(('~/%s' % env('yt_dlp_EXPATH_PATH'))), ('%s/expanded' % compat_getenv('HOME')))
def test_expand_path(self):

    def env(var):
        return (f'%{var}%' if (sys.platform == 'win32') else f'${var}')
    compat_setenv('yt_dlp_EXPATH_PATH', 'expanded')
    self.assertEqual(expand_path(env('yt_dlp_EXPATH_PATH')), 'expanded')
    self.assertEqual(expand_path(env('HOME')), compat_getenv('HOME'))
    self.assertEqual(expand_path('~'), compat_getenv('HOME'))
    self.assertEqual(expand_path(('~/%s' % env('yt_dlp_EXPATH_PATH'))), ('%s/expanded' % compat_getenv('HOME')))