'Tests that chaining constraints raises an error.'

def test_chained_constraints(self):

    error_str = 'Cannot    evaluate    the    truth    value    of    a    constraint    or    chain    constraints,    e.g.,    1    >=    x    >=    0.'
    with self.assertRaises(Exception) as cm:
        (self.z <= self.x <= 1)
    self.assertEqual(str(cm.exception), error_str)
    with self.assertRaises(Exception) as cm:
        (self.x == self.z == 1)
    self.assertEqual(str(cm.exception), error_str)
    if PY2:
        with self.assertRaises(Exception) as cm:
            (self.z <= self.x).__nonzero__()
        self.assertEqual(str(cm.exception), error_str)
    else:
        with self.assertRaises(Exception) as cm:
            (self.z <= self.x).__bool__()
        self.assertEqual(str(cm.exception), error_str)
