|
1 | 1 | import plotly.graph_objs as go |
2 | 2 | from plotly.subplots import make_subplots |
3 | | -from plotly.basedatatypes import _indexing_combinations, _unzip_pairs |
| 3 | +from plotly.basedatatypes import _indexing_combinations |
4 | 4 | import pytest |
| 5 | +from itertools import product |
5 | 6 |
|
6 | 7 | NROWS = 4 |
7 | 8 | NCOLS = 5 |
@@ -154,29 +155,17 @@ def _sort_row_col_lists(rows, cols): |
154 | 155 | @pytest.mark.parametrize( |
155 | 156 | "test_input,expected", |
156 | 157 | [ |
157 | | - ( |
158 | | - ("all", [2, 4, 5], False), |
159 | | - _unzip_pairs([(r, c) for r in range(1, NROWS + 1) for c in [2, 4, 5]]), |
160 | | - ), |
161 | | - ( |
162 | | - ([1, 3], "all", False), |
163 | | - _unzip_pairs([(r, c) for r in [1, 3] for c in range(1, NCOLS + 1)]), |
164 | | - ), |
165 | | - ( |
166 | | - ([1, 3], "all", True), |
167 | | - _unzip_pairs([(r, c) for r in [1, 3] for c in range(1, NCOLS + 1)]), |
168 | | - ), |
169 | | - (([1, 3], [2, 4, 5], False), _unzip_pairs([(1, 2), (3, 4)])), |
170 | | - ( |
171 | | - ([1, 3], [2, 4, 5], True), |
172 | | - _unzip_pairs([(r, c) for r in [1, 3] for c in [2, 4, 5]]), |
173 | | - ), |
| 158 | + (("all", [2, 4, 5], False), zip(*product(range(1, NROWS + 1), [2, 4, 5])),), |
| 159 | + (([1, 3], "all", False), zip(*product([1, 3], range(1, NCOLS + 1))),), |
| 160 | + (([1, 3], "all", True), zip(*product([1, 3], range(1, NCOLS + 1))),), |
| 161 | + (([1, 3], [2, 4, 5], False), [(1, 3), (2, 4)]), |
| 162 | + (([1, 3], [2, 4, 5], True), zip(*product([1, 3], [2, 4, 5])),), |
174 | 163 | ], |
175 | 164 | ) |
176 | 165 | def test_select_subplot_coordinates(subplot_fig_fixture, test_input, expected): |
177 | 166 | rows, cols, product = test_input |
178 | 167 | er, ec = _sort_row_col_lists(*expected) |
179 | 168 | t = subplot_fig_fixture._select_subplot_coordinates(rows, cols, product=product) |
180 | | - r, c = _unzip_pairs(t) |
| 169 | + r, c = zip(*t) |
181 | 170 | r, c = _sort_row_col_lists(r, c) |
182 | 171 | assert (r == er) and (c == ec) |
0 commit comments