<s> """<STR_LIT>""" <EOL> from causal . lastfm . service import ServiceHandler <EOL> from causal . main . models import UserService <EOL> from django . test import TestCase <EOL> from django . utils import simplejson <EOL> import os <EOL> try : <EOL> import wingdbstub <EOL> except ImportError : <EOL> pass <EOL> class TestLastfmService ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . path = os . path . dirname ( os . path . realpath ( __file__ ) ) <EOL> self . handler = ServiceHandler ( model_instance = UserService ( ) ) <EOL> def tearDown ( self ) : <EOL> pass <EOL> def _loadJson ( self , name ) : <EOL> return simplejson . load ( file ( os . path . join ( self . path , '<STR_LIT>' , name ) ) ) <EOL> def test_convert_recent_tracks_json ( self ) : <EOL> """<STR_LIT>""" <EOL> json = self . _loadJson ( '<STR_LIT>' ) <EOL> service_items = self . handler . _convert_recent_tracks_json ( json ) <EOL> self . assertEqual ( len ( service_items ) , <NUM_LIT:10> ) <EOL> def test_convert_recent_tracks_json_no_recent_tracks ( self ) : <EOL> """<STR_LIT>""" <EOL> json = self . _loadJson ( '<STR_LIT>' ) <EOL> service_items = self . handler . _convert_recent_tracks_json ( json ) <EOL> self . assertEqual ( len ( service_items ) , <NUM_LIT:0> ) <EOL> def test_convert_recent_tracks_json_unknown_user ( self ) : <EOL> """<STR_LIT>""" <EOL> json = self . _loadJson ( '<STR_LIT>' ) <EOL> service_items = self . handler . _convert_recent_tracks_json ( json ) <EOL> self . assertEqual ( len ( service_items ) , <NUM_LIT:0> ) <EOL> def test_convert_top_artists ( self ) : <EOL> """<STR_LIT>""" <EOL> json = self . _loadJson ( '<STR_LIT>' ) <EOL> service_items = self . handler . _convert_top_artists_json ( json ) <EOL> self . assertEqual ( len ( service_items ) , <NUM_LIT:50> ) <EOL> def test_convert_top_artists_unknown_user ( self ) : <EOL> """<STR_LIT>""" <EOL> json = self . _loadJson ( '<STR_LIT>' ) <EOL> service_items = self . handler . _convert_top_artists_json ( json ) <EOL> self . assertEqual ( len ( service_items ) , <NUM_LIT:0> ) <EOL> def test_convert_top_artists_none ( self ) : <EOL> """<STR_LIT>""" <EOL> json = self . _loadJson ( '<STR_LIT>' ) <EOL> service_items = self . handler . _convert_top_artists_json ( json ) <EOL> self . assertEqual ( len ( service_items ) , <NUM_LIT:0> ) </s>
