def test_mcweeny():
    np.random.seed(82)
    opdm = np.array([[
        0.766034130, -0.27166330, -0.30936072, -0.08471057, -0.04878244,
        -0.01285432
    ],
                     [
                         -0.27166330, 0.67657015, -0.37519640, -0.02101843,
                         -0.03568214, -0.05034585
                     ],
                     [
                         -0.30936072, -0.37519640, 0.55896791, 0.04267370,
                         -0.02258184, -0.08783738
                     ],
                     [
                         -0.08471057, -0.02101843, 0.04267370, 0.05450848,
                         0.11291253, 0.17131658
                     ],
                     [
                         -0.04878244, -0.03568214, -0.02258184, 0.11291253,
                         0.26821219, 0.42351185
                     ],
                     [
                         -0.01285432, -0.05034585, -0.08783738, 0.17131658,
                         0.42351185, 0.67570713
                     ]])
    for i, j in product(range(6), repeat=2):
        opdm[i, j] += np.random.randn() * 1.0E-3
    opdm = 0.5 * (opdm + opdm.T)
    pure_opdm = mcweeny_purification(opdm)
    w, _ = np.linalg.eigh(pure_opdm)
    assert len(np.where(w < -1.0E-9)[0]) == 0