mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-07-06 04:51:48 -07:00
[Cache] Add clear
function
This commit is contained in:
parent
c052a16f72
commit
ec75141bf0
2 changed files with 43 additions and 11 deletions
|
@ -66,6 +66,18 @@ class TestCache(unittest.TestCase):
|
|||
new_version = '.'.join(('%0.2d' % ((v + 1) if i == 0 else v, )) for i, v in enumerate(version_tuple(__version__)))
|
||||
self.assertIs(c.load('test_cache', 'k.', min_ver=new_version), None)
|
||||
|
||||
def test_cache_clear(self):
|
||||
ydl = FakeYDL({
|
||||
'cachedir': self.test_dir,
|
||||
})
|
||||
c = Cache(ydl)
|
||||
c.store('test_cache', 'k.', 'kay')
|
||||
c.store('test_cache', 'l.', 'ell')
|
||||
self.assertEqual(c.load('test_cache', 'k.'), 'kay')
|
||||
c.clear('test_cache', 'k.')
|
||||
self.assertEqual(c.load('test_cache', 'k.'), None)
|
||||
self.assertEqual(c.load('test_cache', 'l.'), 'ell')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue