<s> try : <EOL> import json <EOL> except ImportError : <EOL> import simplejson as json <EOL> from soundcloud . resource import wrapped_resource , ResourceList , Resource <EOL> from soundcloud . tests . utils import MockResponse <EOL> from nose . tools import eq_ <EOL> def test_json_list ( ) : <EOL> """<STR_LIT>""" <EOL> resources = wrapped_resource ( MockResponse ( json . dumps ( [ { '<STR_LIT:foo>' : '<STR_LIT:bar>' } ] ) , <EOL> encoding = '<STR_LIT:utf-8>' ) ) <EOL> assert isinstance ( resources , ResourceList ) <EOL> eq_ ( <NUM_LIT:1> , len ( resources ) ) <EOL> eq_ ( '<STR_LIT:bar>' , resources [ <NUM_LIT:0> ] . foo ) <EOL> def test_json_object ( ) : <EOL> """<STR_LIT>""" <EOL> resource = wrapped_resource ( MockResponse ( json . dumps ( { '<STR_LIT:foo>' : '<STR_LIT:bar>' } ) , <EOL> encoding = '<STR_LIT:utf-8>' ) ) <EOL> assert isinstance ( resource , Resource ) <EOL> eq_ ( '<STR_LIT:bar>' , resource . foo ) <EOL> def test_properties_copied ( ) : <EOL> """<STR_LIT>""" <EOL> response = MockResponse ( json . dumps ( { '<STR_LIT:foo>' : '<STR_LIT:bar>' } ) , <EOL> encoding = '<STR_LIT:utf-8>' , <EOL> status_code = <NUM_LIT:200> , <EOL> reason = '<STR_LIT:OK>' , <EOL> url = '<STR_LIT>' ) <EOL> resource = wrapped_resource ( response ) <EOL> eq_ ( <NUM_LIT:200> , resource . status_code ) <EOL> eq_ ( '<STR_LIT:OK>' , resource . reason ) <EOL> eq_ ( '<STR_LIT:utf-8>' , resource . encoding ) <EOL> eq_ ( '<STR_LIT>' , resource . url ) </s>
