Ejemplo n.º 1
0
def test_sep_inserter_inserts_separator_between_two_numbers(x):
    # Rather than just replicating the the results in a different
    # algorithm, validate that the "shape" of the output is as expected.
    result = list(utils.sep_inserter(iter(x), ""))
    for i, pos in enumerate(result[1:-1], 1):
        if pos == "":
            assert isinstance(result[i - 1], py23_int)
            assert isinstance(result[i + 1], py23_int)
Ejemplo n.º 2
0
def test_sep_inserter_inserts_separator_between_two_numbers(x):
    # Rather than just replicating the the results in a different
    # algorithm, validate that the "shape" of the output is as expected.
    result = list(utils.sep_inserter(iter(x), ""))
    for i, pos in enumerate(result[1:-1], 1):
        if pos == "":
            assert isinstance(result[i - 1], py23_int)
            assert isinstance(result[i + 1], py23_int)
Ejemplo n.º 3
0
def test_sep_inserter_inserts_separator_string_between_two_numbers_example():
    assert list(utils.sep_inserter(iter([5, 9]), "")) == ["", 5, "", 9]
Ejemplo n.º 4
0
def test_sep_inserter_does_nothing_if_only_one_number_example():
    assert list(utils.sep_inserter(iter(["a", 5]), "")) == ["a", 5]
Ejemplo n.º 5
0
def test_sep_inserter_does_nothing_if_no_numbers_example():
    assert list(utils.sep_inserter(iter(["a", "b", "c"]),
                                   "")) == ["a", "b", "c"]
    assert list(utils.sep_inserter(iter(["a"]), "")) == ["a"]
Ejemplo n.º 6
0
def test_sep_inserter_inserts_separator_string_between_two_numbers_example():
    assert list(utils.sep_inserter(iter([5, 9]), "")) == ["", 5, "", 9]
Ejemplo n.º 7
0
def test_sep_inserter_does_nothing_if_only_one_number_example():
    assert list(utils.sep_inserter(iter(["a", 5]), "")) == ["a", 5]
Ejemplo n.º 8
0
def test_sep_inserter_does_nothing_if_no_numbers_example():
    assert list(utils.sep_inserter(iter(["a", "b", "c"]), "")) == ["a", "b", "c"]
    assert list(utils.sep_inserter(iter(["a"]), "")) == ["a"]