`d.sum()` looks a bit weak here, maybe `assert_(not d.any())` instead?