MCPcopy Create free account
hub / github.com/dask/dask / test_overlap_internal

Function test_overlap_internal

dask/array/tests/test_overlap.py:48–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46
47
48def test_overlap_internal():
49 x = np.arange(64).reshape((8, 8))
50 d = da.from_array(x, chunks=(4, 4))
51
52 g = overlap_internal(d, {0: 2, 1: 1})
53 result = g.compute(scheduler="sync")
54 assert g.chunks == ((6, 6), (5, 5))
55
56 expected = np.array(
57 [
58 [0, 1, 2, 3, 4, 3, 4, 5, 6, 7],
59 [8, 9, 10, 11, 12, 11, 12, 13, 14, 15],
60 [16, 17, 18, 19, 20, 19, 20, 21, 22, 23],
61 [24, 25, 26, 27, 28, 27, 28, 29, 30, 31],
62 [32, 33, 34, 35, 36, 35, 36, 37, 38, 39],
63 [40, 41, 42, 43, 44, 43, 44, 45, 46, 47],
64 [16, 17, 18, 19, 20, 19, 20, 21, 22, 23],
65 [24, 25, 26, 27, 28, 27, 28, 29, 30, 31],
66 [32, 33, 34, 35, 36, 35, 36, 37, 38, 39],
67 [40, 41, 42, 43, 44, 43, 44, 45, 46, 47],
68 [48, 49, 50, 51, 52, 51, 52, 53, 54, 55],
69 [56, 57, 58, 59, 60, 59, 60, 61, 62, 63],
70 ]
71 )
72
73 assert_eq(result, expected)
74 assert same_keys(overlap_internal(d, {0: 2, 1: 1}), g)
75
76
77def test_overlap_internal_asymmetric():

Callers

nothing calls this directly

Calls 6

overlap_internalFunction · 0.90
assert_eqFunction · 0.90
same_keysFunction · 0.90
reshapeMethod · 0.80
arangeMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected