`expected` is probably the only array you need to write out explicitly. `mask` and `image` could be more easily defined as

```
mask = np.zeros(expected.shape, dtype=np.uint8)
mask[3:12, 3:12] = 1

image = expected.copy()
image[mask == 1] = 0
```