from unittest.mock import MagicMock

import bonobo
import pytest
from bonobo.config.processors import ContextCurrifier


def test_count():
    with pytest.raises(TypeError):
        bonobo.count()

    context = MagicMock()

    currified = ContextCurrifier(bonobo.count)
    currified.setup(context)

    for i in range(42):
        currified()
    currified.teardown()

    assert len(context.method_calls) == 1
    bag = context.send.call_args[0][0]
    assert isinstance(bag, bonobo.Bag)
    assert 0 == len(bag.kwargs)
    assert 1 == len(bag.args)
    assert bag.args[0] == 42

@@ -112,16 +112,58 @@
 rrifier%0A
+from bonobo.constants import NOT_MODIFIED%0A
 %0A%0Adef te
@@ -618,8 +618,742 @@
 %5D == 42%0A
+%0A%0Adef test_identity():%0A    assert bonobo.identity(42) == 42%0A%0A%0Adef test_limit():%0A    limit = bonobo.Limit(2)%0A    results = %5B%5D%0A    for i in range(42):%0A        results += list(limit())%0A    assert results == %5BNOT_MODIFIED%5D * 2%0A%0A%0Adef test_limit_not_there():%0A    limit = bonobo.Limit(42)%0A    results = %5B%5D%0A    for i in range(10):%0A        results += list(limit())%0A    assert results == %5BNOT_MODIFIED%5D * 10%0A%0A%0Adef test_tee():%0A    inner = MagicMock(side_effect=bonobo.identity)%0A    tee = bonobo.Tee(inner)%0A    results = %5B%5D%0A    for i in range(10):%0A        results.append(tee('foo'))%0A%0A    assert results == %5BNOT_MODIFIED%5D * 10%0A    assert len(inner.mock_calls) == 10%0A%0A%0Adef test_noop():%0A    assert bonobo.noop(1, 2, 3, 4, foo='bar') == NOT_MODIFIED%0A

Update basic tests.