def test_init(self):

        # Gating scalar node
        Z = Categorical(np.ones(3)/3)
        X = GaussianARD(0, 1, shape=(), plates=(3,))
        Y = Gate(Z, X)
        self.assertEqual(Y.plates, ())
        self.assertEqual(Y.dims, ( (), () ))

        # Gating non-scalar node
        Z = Categorical(np.ones(3)/3)
        X = GaussianARD(0, 1, shape=(2,), plates=(3,))
        Y = Gate(Z, X)
        self.assertEqual(Y.plates, ())
        self.assertEqual(Y.dims, ( (2,), (2,2) ))

        # Plates from Z
        Z = Categorical(np.ones(3)/3, plates=(4,))
        X = GaussianARD(0, 1, shape=(2,), plates=(3,))
        Y = Gate(Z, X)
        self.assertEqual(Y.plates, (4,))
        self.assertEqual(Y.dims, ( (2,), (2,2) ))

        # Plates from X
        Z = Categorical(np.ones(3)/3)
        X = GaussianARD(0, 1, shape=(2,), plates=(4,3))
        Y = Gate(Z, X)
        self.assertEqual(Y.plates, (4,))
        self.assertEqual(Y.dims, ( (2,), (2,2) ))

        # Plates from Z and X
        Z = Categorical(np.ones(3)/3, plates=(5,))
        X = GaussianARD(0, 1, shape=(2,), plates=(4,1,3))
        Y = Gate(Z, X)
        self.assertEqual(Y.plates, (4,5))
        self.assertEqual(Y.dims, ( (2,), (2,2) ))

        # Gating non-default plate
        Z = Categorical(np.ones(3)/3)
        X = GaussianARD(0, 1, shape=(), plates=(3,4))
        Y = Gate(Z, X, gated_plate=-2)
        self.assertEqual(Y.plates, (4,))
        self.assertEqual(Y.dims, ( (), () ))

        # Fixed gating
        Z = 2
        X = GaussianARD(0, 1, shape=(2,), plates=(3,))
        Y = Gate(Z, X)
        self.assertEqual(Y.plates, ())
        self.assertEqual(Y.dims, ( (2,), (2,2) ))

        # Fixed X
        Z = Categorical(np.ones(3)/3)
        X = [1, 2, 3]
        Y = Gate(Z, X, moments=GaussianMoments(()))
        self.assertEqual(Y.plates, ())
        self.assertEqual(Y.dims, ( (), () ))

        # Do not accept non-negative cluster plates
        Z = Categorical(np.ones(3)/3)
        X = GaussianARD(0, 1, plates=(3,))
        self.assertRaises(ValueError,
                          Gate,
                          Z,
                          X,
                          gated_plate=0)
        
        # None of the parents have the cluster plate axis
        Z = Categorical(np.ones(3)/3)
        X = GaussianARD(0, 1)
        self.assertRaises(ValueError,
                          Gate,
                          Z,
                          X)

        # Inconsistent cluster plate
        Z = Categorical(np.ones(3)/3)
        X = GaussianARD(0, 1, plates=(2,))
        self.assertRaises(ValueError,
                          Gate,
                          Z,
                          X)

        pass
Test the creation of Gate node
dataset/ETHPy150Open bayespy/bayespy/bayespy/inference/vmp/nodes/tests/test_gate.py/TestGate.test_init