@@ -578,10 +578,39 @@ def test_cache_remove(self):
578578 tools ,
579579 ['cache-remove' , '--cache' , str (self .cache .path ), '--key' , 'key' ])
580580
581- success = "Removed key 'key' from cache '%s'\n " % self .cache .path
581+ success = \
582+ f"Removed key 'key' from cache '{ str (self .cache .path )} '\n " \
583+ f"Removed key(s) '('key',)' from cache '{ str (self .cache .path )} '\n "
582584 self .assertEqual (success , result .output )
583585 self .assertFalse ('key' in self .cache .get_keys ())
584586
587+ def test_cache_remove_multiple (self ):
588+ self .cache .save (self .art1 , 'key1' )
589+ self .cache .save (self .art1 , 'key2' )
590+ self .cache .save (self .art1 , 'key3' )
591+
592+ keys = self .cache .get_keys ()
593+ self .assertEqual (set (['key1' , 'key2' , 'key3' ]), keys )
594+
595+ result = self .runner .invoke (
596+ tools ,
597+ ['cache-remove' , '--cache' , str (self .cache .path ), '--key' , 'key1' ,
598+ '--key' , 'key2' ]
599+ )
600+
601+ success = \
602+ f"Removed key 'key1' from cache '{ str (self .cache .path )} '\n " \
603+ f"Removed key 'key2' from cache '{ str (self .cache .path )} '\n " \
604+ "Removed key(s) '('key1', 'key2')' from cache " \
605+ f"'{ str (self .cache .path )} '\n "
606+
607+ new_keys = self .cache .get_keys ()
608+
609+ self .assertEqual (success , result .output )
610+ self .assertFalse ('key1' in new_keys )
611+ self .assertFalse ('key2' in new_keys )
612+ self .assertTrue ('key3' in new_keys )
613+
585614 def test_cache_garbage_collection (self ):
586615 # Data referenced directly by key
587616 self .cache .save (self .art1 , 'foo' )
0 commit comments