コード例 #1
0
 def test_take_first(self):
     assert [0, 1, 2] == list(take_first(3)(range(10)))
コード例 #2
0
ファイル: test_main.py プロジェクト: 0101/pipetools
 def test_format_generator(self):
     f = StringFormatter('{0} + {0} = {1}')
     assert f(range(1, 3)) == '1 + 1 = 2'
コード例 #3
0
 def test_input(self):
     result = range(5) > where(X % 2) | list
     assert result == [1, 3]
コード例 #4
0
 def test_iterable(self):
     assert (range(10000) > drop_first(9999) | list) == [9999]
コード例 #5
0
ファイル: test_utils.py プロジェクト: 0101/pipetools
 def test_take_first(self):
     assert [0, 1, 2] == list(take_first(3)(range(10)))
コード例 #6
0
ファイル: utils.py プロジェクト: chenghsienwen/pipetools
 def _drop_first(iterable):
     g = (x for x in range(1, count + 1))
     return dropwhile(lambda i: unless(StopIteration, lambda: next(g))(),
                      iterable)
コード例 #7
0
ファイル: test_utils.py プロジェクト: 0101/pipetools
 def test_iterable(self):
     assert (range(10000) > drop_first(9999) | list) == [9999]
コード例 #8
0
ファイル: test_utils.py プロジェクト: 0101/pipetools
 def test_input(self):
     result = range(5) > where(X % 2) | list
     assert result == [1, 3]
コード例 #9
0
ファイル: test_main.py プロジェクト: yuhan0/pipetools
 def test_format_generator(self):
     f = StringFormatter('{0} + {0} = {1}')
     assert f(range(1, 3)) == '1 + 1 = 2'
コード例 #10
0
ファイル: utils.py プロジェクト: 0101/pipetools
 def _drop_first(iterable):
     g = (x for x in range(1, count + 1))
     return dropwhile(
         lambda i: unless(StopIteration, lambda: next(g))(), iterable)
コード例 #11
0
ファイル: test_ds_builder.py プロジェクト: 0101/pipetools
def test_nested():

    f = DSBuilder({'seq': [X * y for y in range(4)]})

    assert f(2) == {'seq': [0, 2, 4, 6]}