def timeline(producer, window=('w', '%Y-%m-%d-%H', '')): """Count the number of tweets per window.""" producer( consumers.to_tweet( consumers.timeline( window=window, target=consumers.counter_printer(sys.stdout), ), ), )
def test_count_timeline(tweets): counter = Counter() from_iterable( consumers.to_tweet(consumers.timeline(counter), ), tweets, ) assert counter == Counter({ '2012-05-12-09': 1, '2012-04-26-07': 1, '2012-04-13-13': 1, })
def test_count_timeline(tweets): counter = Counter() from_iterable( consumers.to_tweet( consumers.timeline(counter), ), tweets, ) assert counter == Counter( { '2012-05-12-09': 1, '2012-04-26-07': 1, '2012-04-13-13': 1, } )