assert_equal(c(7.0), 7.0)
// this should always fail
c = Constraints(EnsureFloat(), EnsureRange(max=4), EnsureRange(min=9))
self.assertRaises(ValueError, lambda: c(1.0))
def test_altconstraints(self):
// this should always work
c = AltConstraints(EnsureFloat())
After Change
assert_raises(ValueError, c, 3.9)
assert_raises(ValueError, c, 9.01)
// __and__ form
c = EnsureFloat() & EnsureRange(min=4) & EnsureRange(max=9)
assert_equal(c(7.0), 7.0)
assert_raises(ValueError, c, 3.99)
assert_raises(ValueError, c, 9.01)
// and reordering should not have any effect