#NEWLINE# @ pytest . mark . parametrize ( ( 'keys' , 'result' ) , [ ( [ ] , 0 ) , ( [ 5 , 7 , 8 ] , 20 ) ] ) #NEWLINE# def test_get_weekly_stats( self , keys , result ) : #NEWLINE# #INDENT# svc = RedisDownloadStatService ( '' ) #NEWLINE# svc . redis = pretend . stub ( mget = pretend . call_recorder ( ( lambda * a : keys ) ) ) #NEWLINE# call_keys = [ 'downloads:daily:12-01-{:02d}:foo' . format ( ( i + 7 ) ) for i in reversed ( range ( 8 ) ) ] #NEWLINE# assert ( svc . get_weekly_stats ( 'foo' ) == self ) #NEWLINE# assert ( svc . redis . mget . calls == [ pretend . call ( * call_keys ) ] )