<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> from nose . tools import assert_equal <EOL> from sklearn . utils . fast_dict import IntFloatDict , argmin <EOL> from sklearn . externals . six . moves import xrange <EOL> def test_int_float_dict ( ) : <EOL> rng = np . random . RandomState ( <NUM_LIT:0> ) <EOL> keys = np . unique ( rng . randint ( <NUM_LIT:100> , size = <NUM_LIT:10> ) . astype ( np . intp ) ) <EOL> values = rng . rand ( len ( keys ) ) <EOL> d = IntFloatDict ( keys , values ) <EOL> for key , value in zip ( keys , values ) : <EOL> assert_equal ( d [ key ] , value ) <EOL> assert_equal ( len ( d ) , len ( keys ) ) <EOL> d . append ( <NUM_LIT> , <NUM_LIT> ) <EOL> assert_equal ( d [ <NUM_LIT> ] , <NUM_LIT> ) <EOL> assert_equal ( len ( d ) , len ( keys ) + <NUM_LIT:1> ) <EOL> for i in xrange ( <NUM_LIT> ) : <EOL> d . append ( i + <NUM_LIT:1000> , <NUM_LIT> ) <EOL> assert_equal ( d [ <NUM_LIT> ] , <NUM_LIT> ) <EOL> def test_int_float_dict_argmin ( ) : <EOL> keys = np . arange ( <NUM_LIT:100> , dtype = np . intp ) <EOL> values = np . arange ( <NUM_LIT:100> , dtype = np . float64 ) <EOL> d = IntFloatDict ( keys , values ) <EOL> assert_equal ( argmin ( d ) , ( <NUM_LIT:0> , <NUM_LIT:0> ) ) </s>
