Make shallow cloning optional

Could you add a similar test for when shallow=True?