|
13 | 13 | reduceby, iterate, accumulate, |
14 | 14 | sliding_window, count, partition, |
15 | 15 | partition_all, take_nth, pluck, join, |
16 | | - diff, topk, peek, random_sample) |
| 16 | + diff, topk, peek, random_sample, zip_dict) |
17 | 17 | from toolz.compatibility import range, filter |
18 | 18 | from operator import add, mul |
19 | 19 |
|
@@ -123,6 +123,21 @@ def test_isdistinct(): |
123 | 123 | assert isdistinct(iter([1, 2, 1])) is False |
124 | 124 |
|
125 | 125 |
|
| 126 | +def test_zip_dict (): |
| 127 | + assert tuple(zip_dict()) == () |
| 128 | + assert tuple(zip_dict({0: 0})) == ((0, (0 ,)),) |
| 129 | + assert tuple(zip_dict({0: 0}, {1: 1})) == () |
| 130 | + assert tuple(zip_dict({0: 0}, {0: 1})) == ((0, (0 , 1 )),) |
| 131 | + assert tuple(zip_dict({0: 0}, {0: 0, 1: 1})) == ((0, (0 , 0)),) |
| 132 | + assert tuple(zip_dict({0: 1, 1: 2}, {0: 0, 1: 1})) == ((0, (1 , 0)), |
| 133 | + (1, (2, 1))) |
| 134 | + |
| 135 | + assert tuple(zip_dict({-1: 0, 0: 0, 1: 1, 2: 2}, |
| 136 | + {-2: 0, 0: 1, 1: 2, 2: 3}, |
| 137 | + {-3: 0, 0: 2, 1: 3, 2: 4})) == ((0, (0 , 1, 2)), |
| 138 | + (1, (1, 2, 3 )), |
| 139 | + (2, (2, 3, 4))) |
| 140 | + |
126 | 141 | def test_nth(): |
127 | 142 | assert nth(2, 'ABCDE') == 'C' |
128 | 143 | assert nth(2, iter('ABCDE')) == 'C' |
|
0 commit comments