|
8 | 8 | concat, concatv, interleave, unique, |
9 | 9 | isiterable, getter, |
10 | 10 | mapcat, isdistinct, first, second, |
11 | | - nth, take, tail, drop, interpose, get, |
| 11 | + nth, take, tail, drop, split, interpose, get, |
12 | 12 | rest, last, cons, frequencies, |
13 | 13 | reduceby, iterate, accumulate, |
14 | 14 | sliding_window, count, partition, |
@@ -172,6 +172,28 @@ def test_drop(): |
172 | 172 | assert list(drop(1, (3, 2, 1))) == list((2, 1)) |
173 | 173 |
|
174 | 174 |
|
| 175 | +def test_split(): |
| 176 | + l = [10, 20, 30, 40, 50] |
| 177 | + assert list(map(tuple, split(0, l))) == [tuple(), |
| 178 | + (10,), |
| 179 | + (20, 30, 40, 50)] |
| 180 | + |
| 181 | + l = [10, 20, 30, 40, 50] |
| 182 | + assert list(map(tuple, split(4, l))) == [(10, 20, 30, 40,), |
| 183 | + (50,), |
| 184 | + tuple()] |
| 185 | + |
| 186 | + l = [10, 20, 30, 40, 50] |
| 187 | + assert list(map(tuple, split(5, l))) == [(10, 20, 30, 40, 50), |
| 188 | + tuple(), |
| 189 | + tuple()] |
| 190 | + |
| 191 | + l = [10, 20, 30, 40, 50] |
| 192 | + assert list(map(tuple, split(2, l))) == [(10, 20), |
| 193 | + (30,), |
| 194 | + (40, 50)] |
| 195 | + |
| 196 | + |
175 | 197 | def test_take_nth(): |
176 | 198 | assert list(take_nth(2, 'ABCDE')) == list('ACE') |
177 | 199 |
|
|
0 commit comments