<s> """<STR_LIT>""" <EOL> from __future__ import with_statement <EOL> import sys <EOL> sys . path . append ( "<STR_LIT>" ) <EOL> sys . path . append ( "<STR_LIT>" ) <EOL> from twisted . trial import unittest as twunit <EOL> import unittest <EOL> import txml <EOL> class XMLParserTest ( twunit . TestCase ) : <EOL> def parse_test ( self , filename , parser ) : <EOL> with open ( "<STR_LIT>" + filename ) as f : <EOL> parser . write ( f . read ( ) ) <EOL> def testParsingEntry ( self ) : <EOL> ts = self <EOL> def gotEntry ( e ) : <EOL> if e . id == '<STR_LIT>' : <EOL> ts . assertEquals ( '<STR_LIT>' , e . published ) <EOL> ts . assertEquals ( '<STR_LIT>' , e . author . name ) <EOL> ts . assertEquals ( '<STR_LIT>' , <EOL> e . author . uri ) <EOL> ts . assertEquals ( <EOL> '<STR_LIT>' , <EOL> e . alternate ) <EOL> ts . assertEquals ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> e . image ) <EOL> ts . assertEquals ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , e . title ) <EOL> ts . assertEquals ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> e . content ) <EOL> self . parse_test ( '<STR_LIT>' , txml . Feed ( gotEntry ) ) <EOL> def testNewParsingEntry ( self ) : <EOL> ts = self <EOL> def gotEntry ( e ) : <EOL> if e . id == '<STR_LIT>' : <EOL> ts . assertEquals ( '<STR_LIT>' , <EOL> e . twitter_source ) <EOL> self . parse_test ( '<STR_LIT>' , txml . Feed ( gotEntry ) ) <EOL> def testParsingUser ( self ) : <EOL> ts = self <EOL> def gotUser ( u ) : <EOL> if u . id == '<STR_LIT>' : <EOL> ts . assertEquals ( '<STR_LIT>' , u . id ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . name ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . screen_name ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . location ) <EOL> ts . assertEquals ( <EOL> '<STR_LIT>' , <EOL> u . description ) <EOL> ts . assertEquals ( '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> u . profile_image_url ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . url ) <EOL> ts . assertEquals ( '<STR_LIT:true>' , u . protected ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . followers_count ) <EOL> self . parse_test ( '<STR_LIT>' , txml . Users ( gotUser ) ) <EOL> def testParsingDirectMessages ( self ) : <EOL> ts = self <EOL> def gotDirectMessage ( dm ) : <EOL> ts . assertEquals ( '<STR_LIT>' , dm . id ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . sender_id ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . text ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . recipient_id ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . created_at ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . sender_screen_name ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . recipient_screen_name ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . sender . id ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . sender . name ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . sender . screen_name ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . sender . location ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . sender . description ) <EOL> ts . assertEquals ( '<STR_LIT>' , <EOL> dm . sender . profile_image_url ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . sender . url ) <EOL> ts . assertEquals ( '<STR_LIT:false>' , dm . sender . protected ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . sender . followers_count ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . recipient . id ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . recipient . name ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . recipient . screen_name ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . recipient . location ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . recipient . description ) <EOL> ts . assertEquals ( '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> dm . recipient . profile_image_url ) <EOL> ts . assertEquals ( '<STR_LIT>' , <EOL> dm . recipient . url ) <EOL> ts . assertEquals ( '<STR_LIT:false>' , dm . recipient . protected ) <EOL> ts . assertEquals ( '<STR_LIT>' , dm . recipient . followers_count ) <EOL> self . parse_test ( '<STR_LIT>' , txml . Direct ( gotDirectMessage ) ) <EOL> def testParsingStatusList ( self ) : <EOL> ts = self <EOL> def gotStatusItem ( s ) : <EOL> if s . id == '<STR_LIT>' : <EOL> ts . assertEquals ( '<STR_LIT>' , s . id ) <EOL> ts . assertEquals ( '<STR_LIT>' , s . created_at ) <EOL> ts . assertEquals ( '<STR_LIT>' <EOL> '<STR_LIT>' , s . text ) <EOL> ts . assertEquals ( '<STR_LIT:false>' , s . truncated ) <EOL> ts . assertEquals ( '<STR_LIT>' , s . in_reply_to_status_id ) <EOL> ts . assertEquals ( '<STR_LIT>' , s . in_reply_to_user_id ) <EOL> ts . assertEquals ( '<STR_LIT:false>' , s . favorited ) <EOL> ts . assertEquals ( '<STR_LIT>' , s . in_reply_to_screen_name ) <EOL> ts . assertEquals ( '<STR_LIT>' , s . user . id ) <EOL> ts . assertEquals ( '<STR_LIT>' , s . user . name ) <EOL> ts . assertEquals ( '<STR_LIT>' , s . user . screen_name ) <EOL> ts . assertEquals ( '<STR_LIT>' , <EOL> s . user . location ) <EOL> ts . assertEquals ( '<STR_LIT>' , s . user . description ) <EOL> ts . assertEquals ( '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> s . user . profile_image_url ) <EOL> ts . assertEquals ( '<STR_LIT>' , s . user . url ) <EOL> ts . assertEquals ( '<STR_LIT:false>' , s . user . protected ) <EOL> ts . assertEquals ( '<STR_LIT>' , s . user . followers_count ) <EOL> self . parse_test ( '<STR_LIT>' , txml . Statuses ( gotStatusItem ) ) <EOL> def testParsingUser ( self ) : <EOL> ts = self <EOL> def gotUser ( u ) : <EOL> ts . assertEquals ( '<STR_LIT>' , u . id ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . name ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . screen_name ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . location ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . description ) <EOL> ts . assertEquals ( '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> u . profile_image_url ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . url ) <EOL> ts . assertEquals ( '<STR_LIT:false>' , u . protected ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . followers_count ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . profile_background_color ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . profile_text_color ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . profile_link_color ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . profile_sidebar_fill_color ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . profile_sidebar_border_color ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . friends_count ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . created_at ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . favourites_count ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . utc_offset ) <EOL> ts . assertEquals ( '<STR_LIT:false>' , u . following ) <EOL> ts . assertEquals ( '<STR_LIT:false>' , u . notifications ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . statuses_count ) <EOL> ts . assertEquals ( '<STR_LIT>' , <EOL> u . status . created_at ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . status . id ) <EOL> ts . assertEquals ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , u . status . text ) <EOL> ts . assertEquals ( '<STR_LIT:false>' , u . status . truncated ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . status . in_reply_to_status_id ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . status . in_reply_to_user_id ) <EOL> ts . assertEquals ( '<STR_LIT:false>' , u . status . favorited ) <EOL> ts . assertEquals ( '<STR_LIT>' , u . status . in_reply_to_screen_name ) <EOL> self . parse_test ( '<STR_LIT>' , txml . Users ( gotUser ) ) <EOL> def testStatusUpdateParse ( self ) : <EOL> with open ( "<STR_LIT>" ) as f : <EOL> id = txml . parseUpdateResponse ( f . read ( ) ) <EOL> self . assertEquals ( '<STR_LIT>' , id ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
