dopt-basics/tests/test_iteration.py

26 lines
626 B
Python

from dopt_basics import iteration
def test_symmetric_iter_1():
l1_in = [1, 2, 3, 4, 5, 6]
l1_out = [1, 6, 2, 5, 3, 4]
l1_calc = list(iteration.symmetric_iter(l1_in))
assert len(l1_in) == len(l1_calc)
assert len(l1_out) == len(l1_calc)
for truth, calc in zip(l1_out, l1_calc):
assert truth == calc
def test_symmetric_iter_2():
l1_in = [1, 2, 3, 4, 5]
l1_out = [1, 5, 2, 4, 3]
l1_calc = list(iteration.symmetric_iter(l1_in))
assert len(l1_in) == len(l1_calc)
assert len(l1_out) == len(l1_calc)
for truth, calc in zip(l1_out, l1_calc):
assert truth == calc