def get_timeline(api): return Timeline( list(reversed(list( Tweet(tw.user.screen_name, tw.text, tw.id) for tw in api.get_timeline(100) ))) )
def test_it_renders_single_line_tweets(): tweet = Tweet( 'fooser', 'this is a tweet', ) expected = Text( ' ', Green(), 'fooser', Default(), ' ', 'this is a tweet', '\n', ) assert expected == CursesTweetRenderer.render(tweet)
def test_it_underlines_selected_tweets(): tweet = Tweet( 'fooser', 'this is a tweet', ) expected = Text( ' ', Green(), 'fooser', Default(), ' ', Default([curses.A_UNDERLINE]), 'this is a tweet', Default(), '\n', ) assert expected == CursesTweetRenderer.render(tweet, selected=True)
def test_renders_with_limited_screen_width(): tweet_text = ( 'This is a long tweet, its 68 characters long. ZzZzZzZzZzZzZzZzZzZzZz') assert 68 == len(tweet_text) tweet = Tweet( 'fooser', tweet_text, ) expected = Text( ' ', Green(), 'fooser', Default(), ' ', 'This is a long tweet, its 68 characters long. ', '\n ', Blue(), '| ', Default(), 'ZzZzZzZzZzZzZzZzZzZzZz', '\n', ) assert expected == CursesTweetRenderer.render(tweet, max_width=62)