コード例 #1
0
def test_interleaving_fails_with_non_iterables(it):
    """"""
    with raises(TypeError):
        tuple(_123_pype().interleave(it))
コード例 #2
0
def test_asking_for_first_or_last_n_items_fails_with_non_int_n(n):
    """"""
    with raises(TypeError):
        tuple(_123_pype().take(n))
コード例 #3
0
def test_teeing_fails_with_non_ints(n):
    """"""
    with raises(TypeError):
        tuple(_123_pype().tee(n))
コード例 #4
0
def test_sorting_fails_with_non_callable_non_none_key(fn):
    """"""
    with raises(TypeError):
        tuple(_123_pype().sort(fn))
コード例 #5
0
def test_splitting_fails_with_non_string_modes(mode):
    """"""
    with raises(TypeError):
        tuple(_123_pype().split(lambda n: n == 2, mode=mode))
コード例 #6
0
def test_slicing_fails_with_negative_start():
    """"""
    with raises(ValueError):
        tuple(_123_pype().slice(-1, 5))
コード例 #7
0
def test_slicing_fails_with_start_larger_than_end():
    """"""

    with raises(ValueError):
        tuple(_123_pype().slice(1, 0))
コード例 #8
0
def test_mapping_fails_with_non_int_chunk_size(chunk_size):
    """"""
    with raises(TypeError):
        tuple(_123_pype().map(lambda x: x * 2,
                              workers=2,
                              chunk_size=chunk_size))
コード例 #9
0
def test_mapping_fails_with_non_positive_chunk_size():
    """"""

    with raises(ValueError):
        tuple(_123_pype().map(lambda x: x * 2, workers=2, chunk_size=-1))
コード例 #10
0
def test_mapping_fails_with_non_int_workers(workers):
    """"""
    with raises(TypeError):
        tuple(_123_pype().map(lambda x: x * 2, workers=workers))
コード例 #11
0
def test_mapping_fails_with_negative_workers():
    """"""
    with raises(ValueError):
        tuple(_123_pype().map(lambda x: x * 2, workers=-1))
コード例 #12
0
def test_multiple_mapping_fails_with_non_callable_function(fn):
    """"""
    with raises(TypeError):
        tuple(_123_pype().map(lambda x: x * 2, fn))
コード例 #13
0
def test_interleaving_fails_with_non_int_n(n):
    """"""
    with raises(TypeError):
        tuple(_123_pype().interleave(_a_fun_day_pype(), n=n))
コード例 #14
0
def test_interleaving_fails_with_non_positive_int(n):
    """"""
    with raises(ValueError):
        tuple(_123_pype().interleave(_a_fun_day_pype(), n=n))
コード例 #15
0
def test_slicing_fails_with_non_int_start(n):
    """"""
    with raises(TypeError):
        tuple(_123_pype().slice(n, 5))
コード例 #16
0
def test_partitioning_fails_with_non_callable_predicates(fn):
    """"""
    with raises(TypeError):
        for _ in _123_pype().partition(fn):
            pass
コード例 #17
0
def test_slicing_fails_with_non_int_end(n):
    """"""
    with raises(TypeError):
        tuple(_123_pype().slice(1, n))
コード例 #18
0
def test_printing_fails_with_non_callable_function(fn):
    """"""
    with raises(TypeError):
        tuple(_123_pype().print(fn))
コード例 #19
0
def test_slicing_fails_with_negative_end():
    """"""
    with raises(ValueError):
        tuple(_123_pype().slice(1, -1))
コード例 #20
0
def test_broadcasting_fails_with_non_callables(fn):
    """"""
    with raises(TypeError):
        tuple(_123_pype().broadcast(fn))
コード例 #21
0
def test_concatenation_fails_with_non_pypes(other):
    """"""
    with raises(TypeError):
        tuple(_123_pype().cat(other))
コード例 #22
0
def test_reducing_fails_with_non_binary_reduction_callable(fn):
    """"""
    with raises(TypeError):
        tuple(_123_pype().reduce(fn))
コード例 #23
0
def test_splitting_fails_with_non_callable_predicate(fn):
    """"""
    with raises(TypeError):
        tuple(_123_pype().split(fn))
コード例 #24
0
def test_sampling_fails_with_non_int_n(n):
    """"""
    with raises(TypeError):
        tuple(_123_pype().sample(n))
コード例 #25
0
def test_splitting_fails_with_unsupported_modes():
    """"""
    with raises(ValueError):
        tuple(_123_pype().split(lambda n: n == 2, mode='non-existent'))
コード例 #26
0
def test_sampling_fails_with_negative_n():
    """"""
    with raises(ValueError):
        tuple(_123_pype().sample(-1))
コード例 #27
0
def test_selecting_items_while_condition_is_met_fails_with_non_callable_predicate(
        fn):
    """"""
    with raises(TypeError):
        tuple(_123_pype().take_while(fn))
コード例 #28
0
def test_selecting_items_fails_with_non_callable_predicate(fn):
    """"""
    with raises(TypeError):
        tuple(_123_pype().select(fn))
コード例 #29
0
def test_teeing_fails_with_non_negatives(n):
    """"""
    with raises(ValueError):
        print(tuple(_123_pype().tee(n)))
コード例 #30
0
def test_grouping_fails_with_non_callable_keys(fn):
    """"""
    with raises(TypeError):
        tuple(_123_pype().group_by(fn))