from datetime import timedelta
import operator
from operator import add
from time import time

import pytest

from tornado import gen
from tornado.queues import Queue
from tornado.ioloop import IOLoop

import streamz as sz

from ..core import Stream
from streamz.sources import sink_to_file, Counter
from streamz.utils_test import inc, double, gen_test, tmpfile


def test_basic():
    source = Stream()
    b1 = source.map(inc)
    b2 = source.map(double)

    c = b1.scan(add)

    Lc = c.sink_to_list()
    Lb = b2.sink_to_list()

    for i in range(4):