[nodes] Removing draft quality factory from bonobo main package, will live in separate personnal package until it is good enough to live here.

This commit is contained in:
Romain Dorgueil
2017-10-23 21:56:13 +02:00
parent ece764b95c
commit dd28e08f0f
3 changed files with 0 additions and 272 deletions

View File

@ -1,66 +0,0 @@
from unittest import TestCase
import pytest
from bonobo import Bag
from bonobo.nodes.factory import Factory
from bonobo.util.testing import BufferingNodeExecutionContext
@pytest.mark.filterwarnings('ignore:Factory')
class FactoryTypeTest(TestCase):
def execute_node(self, node, *rows):
with BufferingNodeExecutionContext(node) as context:
context.write_sync(*rows)
return context.get_buffer()
def test_args_as_str(self):
f = Factory()
f[0].as_str().upper()
output = self.execute_node(f, 'foo', 'bar', 'baz')
assert len(output) == 3
assert output[0] == 'FOO'
assert output[1] == 'BAR'
assert output[2] == 'BAZ'
def test_kwargs_as_str(self):
f = Factory()
f['foo'].as_str().upper()
output = self.execute_node(f, {'foo': 'bar'}, {'foo': 'baz'})
assert len(output) == 2
assert output[0] == {'foo': 'BAR'}
assert output[1] == {'foo': 'BAZ'}
"""
draft below.
if __name__ == '__main__':
f = Factory()
f[0].dict().map_keys({'foo': 'F00'})
print('operations:', f.operations)
print(f({'foo': 'bisou'}, foo='blah'))
specs:
- rename keys of an input dict (in args, or kwargs) using a translation map.
f = Factory()
f[0]
f['xxx'] =
f[0].dict().get('foo.bar').move_to('foo.baz').apply(str.upper)
f[0].get('foo.*').items().map(str.lower)
f['foo'].keys_map({
'a': 'b'
})
"""