diff options
| author | dirkf <fieldhouse@gmx.net> | 2024-04-11 12:47:05 +0100 | 
|---|---|---|
| committer | dirkf <fieldhouse@gmx.net> | 2024-04-22 01:34:26 +0100 | 
| commit | c2766cb80ee9add4d2d2d94b1878e7884c63ceaf (patch) | |
| tree | e9b53c38d5242ad1da0bc5e458ad4d8ed449ee56 /test/test_download.py | |
| parent | eb3866543810c7be96f40ec94e0c00df19b93861 (diff) | |
[test/test_download] Support 'playlist_maxcount:count' expected value
* parallel to `playlist_mincount'
* specify both for a range of playlist lengths
* if max < min the test will always fail!
Diffstat (limited to 'test/test_download.py')
| -rw-r--r-- | test/test_download.py | 14 | 
1 files changed, 13 insertions, 1 deletions
| diff --git a/test/test_download.py b/test/test_download.py index e0bc8cb95..df8b370cf 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -10,6 +10,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))  from test.helper import (      assertGreaterEqual, +    assertLessEqual,      expect_warnings,      get_params,      gettestcases, @@ -122,7 +123,10 @@ def generator(test_case, tname):          params['outtmpl'] = tname + '_' + params['outtmpl']          if is_playlist and 'playlist' not in test_case:              params.setdefault('extract_flat', 'in_playlist') -            params.setdefault('playlistend', test_case.get('playlist_mincount')) +            params.setdefault('playlistend', +                              test_case['playlist_maxcount'] + 1 +                              if test_case.get('playlist_maxcount') +                              else test_case.get('playlist_mincount'))              params.setdefault('skip_download', True)          ydl = YoutubeDL(params, auto_init=False) @@ -190,6 +194,14 @@ def generator(test_case, tname):                      'Expected at least %d in playlist %s, but got only %d' % (                          test_case['playlist_mincount'], test_case['url'],                          len(res_dict['entries']))) +            if 'playlist_maxcount' in test_case: +                assertLessEqual( +                    self, +                    len(res_dict['entries']), +                    test_case['playlist_maxcount'], +                    'Expected at most %d in playlist %s, but got %d' % ( +                        test_case['playlist_maxcount'], test_case['url'], +                        len(res_dict['entries'])))              if 'playlist_count' in test_case:                  self.assertEqual(                      len(res_dict['entries']), | 
