Exemple #1
0
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),
            ), ), )
Exemple #2
0
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),
            ),
        ),
    )
Exemple #3
0
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,
    })
Exemple #4
0
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,
        }
    )