def test_filter(self, string_dataset): """Test filter registering""" flow = Flow().from_source(Source(fin=string_dataset.open())).filter( lambda x: 'line' not in x ) assert flow.chain[0].type == 'FLOW::FILTER' assert flow.batch(1)[0] == ['0', '1', '2', '3', '4']
def test_map(self, numeric_dataset): """Test map registering""" flow = Flow().from_source(Source(fin=numeric_dataset.open())).map( lambda x: [float(_) for _ in x] ).map( lambda x: [2 * _ for _ in x] ) assert flow.chain[0].type == 'FLOW::MAP' assert flow.batch(1)[0] == [0, 0, 2, 4, 6, 8]