[core] Still refactoring the core behaviour of bags, starting to be much simpler.

This commit is contained in:
Romain Dorgueil
2017-10-23 21:18:02 +02:00
committed by Romain Dorgueil
parent f18889830b
commit 9a54f7b4aa
22 changed files with 437 additions and 262 deletions

View File

@ -1,7 +1,6 @@
import pytest
from bonobo import Bag, JsonReader, JsonWriter, settings
from bonobo.constants import BEGIN, END
from bonobo import JsonReader, JsonWriter, settings
from bonobo.execution.node import NodeExecutionContext
from bonobo.util.testing import FilesystemTester
@ -29,8 +28,7 @@ def test_write_json_kwargs(tmpdir, add_kwargs):
fs, filename, services = json_tester.get_services_for_writer(tmpdir)
with NodeExecutionContext(JsonWriter(filename, **add_kwargs), services=services) as context:
context.write(BEGIN, Bag(**{'foo': 'bar'}), END)
context.step()
context.write_sync({'foo': 'bar'})
with fs.open(filename) as fp:
assert fp.read() == '[{"foo": "bar"}]'