<s> from pypy . lib import hashlib , _hashlib <EOL> def test_unicode ( ) : <EOL> assert isinstance ( hashlib . new ( '<STR_LIT>' , u'<STR_LIT>' ) , _hashlib . hash ) <EOL> def test_attributes ( ) : <EOL> for name , expected_size in { '<STR_LIT>' : <NUM_LIT:16> , <EOL> '<STR_LIT>' : <NUM_LIT:20> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:32> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:64> , <EOL> } . items ( ) : <EOL> h = hashlib . new ( name ) <EOL> assert h . digest_size == expected_size <EOL> assert h . digestsize == expected_size <EOL> h . update ( '<STR_LIT:abc>' ) <EOL> h2 = h . copy ( ) <EOL> h . update ( '<STR_LIT>' ) <EOL> digest = h . digest ( ) <EOL> hexdigest = h . hexdigest ( ) <EOL> h2 . update ( '<STR_LIT:d>' ) <EOL> h2 . update ( '<STR_LIT>' ) <EOL> assert digest == h . digest ( ) <EOL> assert hexdigest == h . hexdigest ( ) <EOL> h = hashlib . __get_builtin_constructor ( name ) ( '<STR_LIT>' ) <EOL> assert h . digest_size == expected_size <EOL> assert h . digestsize == expected_size <EOL> h . update ( '<STR_LIT:abc>' ) <EOL> h2 = h . copy ( ) <EOL> h . update ( '<STR_LIT>' ) <EOL> digest = h . digest ( ) <EOL> hexdigest = h . hexdigest ( ) <EOL> h2 . update ( '<STR_LIT:d>' ) <EOL> h2 . update ( '<STR_LIT>' ) <EOL> assert digest == h . digest ( ) <EOL> assert hexdigest == h . hexdigest ( ) </s>
