<s> import twitter <EOL> import json <EOL> import unittest <EOL> class UserTest ( unittest . TestCase ) : <EOL> SAMPLE_JSON = '''<STR_LIT>''' <EOL> def _GetSampleStatus ( self ) : <EOL> return twitter . Status ( created_at = '<STR_LIT>' , <EOL> id = <NUM_LIT> , <EOL> text = '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def _GetSampleUser ( self ) : <EOL> return twitter . User ( id = <NUM_LIT> , <EOL> name = '<STR_LIT>' , <EOL> screen_name = '<STR_LIT>' , <EOL> description = u'<STR_LIT>' , <EOL> location = '<STR_LIT>' , <EOL> url = '<STR_LIT>' , <EOL> profile_image_url = '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> status = self . _GetSampleStatus ( ) ) <EOL> def testInit ( self ) : <EOL> '''<STR_LIT>''' <EOL> twitter . User ( id = <NUM_LIT> , <EOL> name = '<STR_LIT>' , <EOL> screen_name = '<STR_LIT>' , <EOL> description = u'<STR_LIT>' , <EOL> url = '<STR_LIT>' , <EOL> profile_image_url = '<STR_LIT>' , <EOL> status = self . _GetSampleStatus ( ) ) <EOL> def testProperties ( self ) : <EOL> '''<STR_LIT>''' <EOL> user = twitter . User ( ) <EOL> user . id = <NUM_LIT> <EOL> self . assertEqual ( <NUM_LIT> , user . id ) <EOL> user . name = '<STR_LIT>' <EOL> self . assertEqual ( '<STR_LIT>' , user . name ) <EOL> user . screen_name = '<STR_LIT>' <EOL> self . assertEqual ( '<STR_LIT>' , user . screen_name ) <EOL> user . description = '<STR_LIT>' <EOL> self . assertEqual ( '<STR_LIT>' , user . description ) <EOL> user . location = '<STR_LIT>' <EOL> self . assertEqual ( '<STR_LIT>' , user . location ) <EOL> user . profile_image_url = '<STR_LIT>' <EOL> self . assertEqual ( '<STR_LIT>' , user . profile_image_url ) <EOL> self . status = self . _GetSampleStatus ( ) <EOL> self . assertEqual ( <NUM_LIT> , self . status . id ) <EOL> def testAsJsonString ( self ) : <EOL> '''<STR_LIT>''' <EOL> self . assertEqual ( UserTest . SAMPLE_JSON , <EOL> self . _GetSampleUser ( ) . AsJsonString ( ) ) <EOL> def testAsDict ( self ) : <EOL> '''<STR_LIT>''' <EOL> user = self . _GetSampleUser ( ) <EOL> data = user . AsDict ( ) <EOL> self . assertEqual ( <NUM_LIT> , data [ '<STR_LIT:id>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , data [ '<STR_LIT:name>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , data [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , data [ '<STR_LIT:description>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , data [ '<STR_LIT:location>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' <EOL> '<STR_LIT>' , data [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , data [ '<STR_LIT:url>' ] ) <EOL> self . assertEqual ( <NUM_LIT> , data [ '<STR_LIT:status>' ] [ '<STR_LIT:id>' ] ) <EOL> def testEq ( self ) : <EOL> '''<STR_LIT>''' <EOL> user = twitter . User ( ) <EOL> user . id = <NUM_LIT> <EOL> user . name = '<STR_LIT>' <EOL> user . screen_name = '<STR_LIT>' <EOL> user . description = '<STR_LIT>' <EOL> user . location = '<STR_LIT>' <EOL> user . profile_image_url = '<STR_LIT>' '<STR_LIT>' <EOL> user . url = '<STR_LIT>' <EOL> user . status = self . _GetSampleStatus ( ) <EOL> self . assertEqual ( user , self . _GetSampleUser ( ) ) <EOL> def testNewFromJsonDict ( self ) : <EOL> '''<STR_LIT>''' <EOL> data = json . loads ( UserTest . SAMPLE_JSON ) <EOL> user = twitter . User . NewFromJsonDict ( data ) <EOL> self . assertEqual ( self . _GetSampleUser ( ) , user ) </s>
