BUG: Ensure MaskedArray.flat can access single items

Currently, the `MaskedArray.flat` iterator barfs when trying to access single items, because it is tried to overwrite `shape` of a non-ndarray mask (see below). This PR corrects this, and adds test cases.

```
import numpy as np
ma = np.ma.MaskedArray([1,2,3], mask=[0,1,0])
ma.flat[1]
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-d9496ad7cbf6> in <module>()
----> 1 ma.flat[1]

/usr/lib/python3/dist-packages/numpy/ma/core.py in __getitem__(self, indx)
   2530         if self.maskiter is not None:
   2531             _mask = self.maskiter.__getitem__(indx)
-> 2532             _mask.shape = result.shape
   2533             result._mask = _mask
   2534         return result

AttributeError: attribute 'shape' of 'numpy.generic' objects is not writable
```