changeset 783:f84e6f301a18

Merged
author Olivier Delalleau <delallea@iro>
date Fri, 26 Jun 2009 16:44:55 -0400
parents ba068f7d4d3e (diff) b6670cb57101 (current diff)
children ba65e95d1221
files
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/sandbox/test_cost.py	Fri Jun 26 10:46:45 2009 -0400
+++ b/pylearn/algorithms/sandbox/test_cost.py	Fri Jun 26 16:44:55 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("<type 'float'>, must be int or long") >= 0:
+                pass
+            else:
+                raise
 
 class T_nlpoisson(unittest.TestCase):
     def test(self):