Пример #1
0
    def testTupleOnTheLeftMostSideWorkLikeProducers(self):
        from useless.pipes.common import from_list, echo, unique

        # using 'literal' iterables
        self.assertEqual(([1, 2], [3, 4]) | echo | list, [(1, 3), (2, 4)])
        # using useless.pipess: a worker and a producer
        self.assertEqual(([1, 2] | unique, from_list([3, 4])) | echo | list, [(1, 3), (2, 4)])
        #'literal' values repeat
        self.assertEqual(("foo", [1, 2]) | echo | list, [("foo", 1), ("foo", 2)])
Пример #2
0
    def testALiteralValueJustRepeats(self):
        from useless.pipes.common import from_list, echo

        self.assertEqual(from_list([1, 2]) | ("foo", echo) | list, [("foo", 1), ("foo", 2)])
Пример #3
0
    def testAutomaticallyAddLastGeneratorToEachLeftEnd(self):
        from useless.pipes.common import from_list, echo, unique

        self.assertEqual(from_list([1, 3]) | (echo,) | list, [(1,), (3,)])
        self.assertEqual(from_list([1, 2]) | (echo, echo) | list, [(1, 1), (2, 2)])