'Test the EqConstraint class.'

def test_eq_constraint(self):

    constr = (self.x == self.z)
    self.assertEqual(constr.name(), 'x    ==    z')
    self.assertEqual(constr.size, (2, 1))
    assert (constr.dual_value is None)
    assert (constr.value is None)
    self.x.save_value([2, 2])
    self.z.save_value([2, 2])
    assert constr.value
    self.x.save_value([3, 3])
    assert (not constr.value)
    self.x.value = [2, 1]
    self.z.value = [2, 2]
    assert (not constr.value)
    self.assertAlmostEqual(constr.violation, 1)
    self.assertItemsAlmostEqual(constr.residual.value, [0, 1])
    self.z.value = [2, 1]
    assert constr.value
    self.assertAlmostEqual(constr.violation, 0)
    self.assertItemsAlmostEqual(constr.residual.value, [0, 0])
    with self.assertRaises(Exception) as cm:
        (self.x == self.y)
    self.assertEqual(str(cm.exception), 'Incompatible    dimensions    (2,    1)    (3,    1)')
    copy = constr.copy()
    self.assertTrue((type(copy) is type(constr)))
    self.assertEqual(copy.args, constr.args)
    self.assertFalse((copy.args is constr.args))
    copy = constr.copy(args=[self.A, self.B])
    self.assertTrue((type(copy) is type(constr)))
    self.assertTrue((copy.args[0] is self.A))
    self.assertTrue((copy.args[1] is self.B))
