(func)
| 3245 | |
| 3246 | @pytest.mark.parametrize("func", [normalize_chunks, normalize_chunks_cached]) |
| 3247 | def test_normalize_chunks(func): |
| 3248 | assert func(3, (4, 6)) == ((3, 1), (3, 3)) |
| 3249 | assert func(((3, 3), (8,)), (6, 8)) == ((3, 3), (8,)) |
| 3250 | assert func((4, 5), (9,)) == ((4, 5),) |
| 3251 | assert func((4, 5), (9, 9)) == ((4, 4, 1), (5, 4)) |
| 3252 | assert func(-1, (5, 5)) == ((5,), (5,)) |
| 3253 | assert func((3, -1), (5, 5)) == ((3, 2), (5,)) |
| 3254 | assert func((3, None), (5, 5)) == ((3, 2), (5,)) |
| 3255 | if func is normalize_chunks: |
| 3256 | assert func({0: 3}, (5, 5)) == ((3, 2), (5,)) |
| 3257 | assert func([[2, 2], [3, 3]]) == ((2, 2), (3, 3)) |
| 3258 | assert func(10, (30, 5)) == ((10, 10, 10), (5,)) |
| 3259 | assert func((), (0, 0)) == ((0,), (0,)) |
| 3260 | assert func(-1, (0, 3)) == ((0,), (3,)) |
| 3261 | assert func(((float("nan"),),)) == ((np.nan,),) |
| 3262 | |
| 3263 | assert func("auto", shape=(20,), limit=5, dtype="uint8") == ((5, 5, 5, 5),) |
| 3264 | assert func(("auto", None), (5, 5), dtype=int) == ((5,), (5,)) |
| 3265 | |
| 3266 | with pytest.raises(ValueError): |
| 3267 | func(((10,),), (11,)) |
| 3268 | with pytest.raises(ValueError): |
| 3269 | func(((5,), (5,)), (5,)) |
| 3270 | |
| 3271 | |
| 3272 | def test_single_element_tuple(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…