#NEWLINE# def test_shard_key( self ) : #NEWLINE# #INDENT# base = 'test' #NEWLINE# self . assertEquals ( shard_key ( base , 1 , 2 , 2 ) , 'test:0' ) #NEWLINE# self . assertEquals ( shard_key ( base , '1' , 2 , 2 ) , 'test:0' ) #NEWLINE# self . assertEquals ( shard_key ( base , 125 , 1000 , 100 ) , 'test:1' ) #NEWLINE# self . assertEquals ( shard_key ( base , '125' , 1000 , 100 ) , 'test:1' ) #NEWLINE# for i in xrange ( 50 ) : #NEWLINE# #INDENT# self . assertTrue ( ( 0 <= int ( shard_key ( base , ( 'hello:%s' % i ) , 1000 , 100 ) . partition ( ':' ) [ ( - 1 ) ] ) < 20 ) ) #NEWLINE# self . assertTrue ( ( 0 <= int ( shard_key ( base , i , 1000 , 100 ) . partition ( ':' ) [ ( - 1 ) ] ) < 10 ) )