def testPullBack(self):
        p = numpy.array([[0,0,0], [0,0.5,0.5], [0.5,0.2,0.5], [0.5,0.5,0]])

        w = derham3dweights(psijac, psiinvjac, psidet)
        v0 = numpy.array([1,2,3,4]).reshape(-1,1)
        v0p = applyweights(w[0](p), v0)

        numpy.testing.assert_array_almost_equal(v0[...,numpy.newaxis],v0p)
        
        v1 = numpy.array([[0,1,0],[0,1,0],[1,0,0],[0,0,1]]) # normal vectors to the infinite pyramid at psi(p)
        v1p = applyweights(w[1](p), v1[:,numpy.newaxis,:])
        # check that they remain tangent after being mapped
        ns = numpy.array([[0,1,0], [0,1,1], [0.5,0,0.5], [0,0,1]])
        numpy.testing.assert_array_almost_equal(numpy.sum(numpy.abs(numpy.cross(v1p[:,0,:], ns)),axis=1), numpy.zeros(len(p)))
                
        # s=2 pullback preserves tangent vectors
        v2 = numpy.array([[[1,0,0],[0,0,1]], [[1,0,0],[0,0,1]], [[0,1,0],[0,0,1]], [[1,0,0],[0,1,0]]])
        v2p = applyweights(w[2](p), v2)
        
        numpy.testing.assert_array_almost_equal(numpy.sum(v2p * ns[:,numpy.newaxis,:], axis=2), numpy.zeros((len(p),2)))