# HG changeset patch # User Olivier Delalleau # Date 1246024532 14400 # Node ID ba068f7d4d3ebecbc387d02694bb887d07a47ed0 # Parent e768674aa51f2cd19b232739782c374e17647967 Fixed test_float diff -r e768674aa51f -r ba068f7d4d3e pylearn/algorithms/sandbox/test_cost.py --- a/pylearn/algorithms/sandbox/test_cost.py Wed Jun 24 10:53:55 2009 -0400 +++ b/pylearn/algorithms/sandbox/test_cost.py Fri Jun 26 09:55:32 2009 -0400 @@ -14,13 +14,19 @@ def test_float(self): """ - This should fail because we can't use floats in logfactorial + Ensure we cannot use floats in logfactorial. """ x = TT.as_tensor([0.5, 2.7]) o = cost.logfactorial(x) - f = T.function([],o) -# print repr(f()) - self.failUnless(numpy.all(f() == numpy.asarray([0., 0., 1.38629436, 3.29583687, 5.54517744, 8.04718956, 10.75055682, 13.62137104, 16.63553233, 19.7750212]))) + f = T.function([], o) + try: + f() + assert False + except TypeError, e: + if str(e).find(", must be int or long") >= 0: + pass + else: + raise class T_nlpoisson(unittest.TestCase): def test(self):