예제 #1
0
    def test_append_pipeline2(self):
        """Test append pipe opeartion."""
        pipeline = Pipeline().append_transform(lambda x: x * 2)

        pipeline2 = Pipeline() \
            .append_transform(lambda x: x + 10) \
            .append_transform(lambda x: x / 2)

        pipeline.append_pipe(pipeline2)

        # ((10 * 2) + 10) / 2
        self.assertEqual(pipeline.feed(10), 15)
예제 #2
0
    def test_append_pipeline(self):
        """Test append pipe opeartion."""
        pipeline = Pipeline()
        pipeline.append_transform(lambda x: x * 2)

        pipeline2 = Pipeline()
        pipeline2.append_transform(lambda x: x + 10)

        pipeline.append_pipe(pipeline2)

        # (10 * 2) + 10
        self.assertEqual(pipeline.feed(10), 30)