Make copy on write testing more robust.

Copy on write testing was using identity of numpy array objects as a
proxy for identity of the underlying data. This is unsafe as many
array objects can point to the same data. This commit fixes this.