File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ class Cache:
6060 MEMCACHED = AIOCACHE_CACHES .get ("memcached" )
6161
6262 def __new__ (cls , cache_class = MEMORY , ** kwargs ):
63- if not issubclass (cache_class , BaseCache ):
63+ if not ( cache_class and issubclass (cache_class , BaseCache ) ):
6464 raise InvalidCacheType (
6565 "Invalid cache type, you can only use {}" .format (list (AIOCACHE_CACHES .keys ()))
6666 )
Original file line number Diff line number Diff line change @@ -74,9 +74,10 @@ async def test_new(self, cache_type):
7474 def test_new_defaults_to_memory (self ):
7575 assert isinstance (Cache (), Cache .MEMORY )
7676
77- def test_new_invalid_cache_raises (self ):
77+ @pytest .mark .parametrize ("cache_type" , (None , object ))
78+ def test_new_invalid_cache_raises (self , cache_type ):
7879 with pytest .raises (InvalidCacheType ) as e :
79- Cache (object )
80+ Cache (cache_type )
8081 assert str (e .value ) == "Invalid cache type, you can only use {}" .format (
8182 list (AIOCACHE_CACHES .keys ())
8283 )
You can’t perform that action at this time.
0 commit comments