def METHOD_NAME(self):
    bvs = boolvar(shape=4, name="bvs")
    ivs = intvar(1,9, shape=3, name="ivs")
    rv = boolvar(name="rv")
    arr = cpm_array([0,1,2])
    f = lambda expr : str(reify_rewrite(flatten_constraint(expr)))
    fd = lambda expr : str(reify_rewrite(flatten_constraint(decompose_in_tree(expr))))
    # various reify_rewrite cases:
    self.assertEqual(f(rv == bvs[0]), "[(rv) == (bvs[0])]")
    self.assertEqual(f(rv == all(bvs)), "[(and([bvs[0], bvs[1], bvs[2], bvs[3]])) == (rv)]")
    self.assertEqual(f(rv.implies(any(bvs))), "[(rv) -> (or([bvs[0], bvs[1], bvs[2], bvs[3]]))]")
    self.assertEqual(f((bvs[0].implies(bvs[1])).implies(rv)), "[(~rv) -> (bvs[0]), (~rv) -> (~bvs[1])]")
    self.assertRaises(ValueError, lambda : f(rv == AllDifferent(ivs)))
    self.assertEqual(fd([rv.implies(AllDifferent(ivs))]), "[(rv) -> ((ivs[0]) != (ivs[1])), (rv) -> ((ivs[0]) != (ivs[2])), (rv) -> ((ivs[1]) != (ivs[2]))]")
    self.assertEqual(f(rv == (arr[intvar(0, 2)] != 1)), "[([0 1 2][IV0]) == (IV1), (IV1 != 1) == (rv)]")
    self.assertEqual(f(rv == (max(ivs) > 5)), "[(max(ivs[0],ivs[1],ivs[2])) == (IV2), (IV2 > 5) == (rv)]")
    self.assertEqual(f(rv.implies(min(ivs) != 0)), "[(min(ivs[0],ivs[1],ivs[2])) == (IV3), (rv) -> (IV3 != 0)]")
    self.assertEqual(f((min(ivs) != 0).implies(rv)), "[(min(ivs[0],ivs[1],ivs[2])) == (IV4), (IV4 != 0) -> (rv)]"