提交 11fe769a authored 作者: Frederic Bastien's avatar Frederic Bastien

Move a test from theano/scalar/tests/test_basic.py to theano/tensor/tests/test_basic.py.

We do this as in some case the test was failing during theano fct call.(i.e. under ubuntu) As we use theano.tensor.scalar and not theano.scalar.scalar normally this is not a problem.
上级 662e811d
...@@ -31,7 +31,13 @@ class test_ScalarOps(unittest.TestCase): ...@@ -31,7 +31,13 @@ class test_ScalarOps(unittest.TestCase):
fn = gof.DualLinker().accept(g).make_function() fn = gof.DualLinker().accept(g).make_function()
assert fn(1.0, 2.0) == 1.5 assert fn(1.0, 2.0) == 1.5
def test_mod(self): #This test is moved to theano.tensor.tests.test_basic.py:test_mod
#We move it their as under ubuntu the c_extract call of theano.scalar
#call PyInt_check and it fail under some os. If work in other case.
#As we use theano.scalar normally, but we use theano.tensor.scalar
#that is not important. Also this make the theano fct fail at call time
#so this is not a silent bug.
def tes_mod(self):
""" """
We add this test as not all language and C implementation give the same We add this test as not all language and C implementation give the same
signe to the result. This check that the c_code of `Mod` is implemented signe to the result. This check that the c_code of `Mod` is implemented
......
...@@ -2562,6 +2562,20 @@ def test_unbroadcast_addbroadcast(): ...@@ -2562,6 +2562,20 @@ def test_unbroadcast_addbroadcast():
assert addbroadcast(unbroadcast(x,1),0).owner.inputs[0] is x assert addbroadcast(unbroadcast(x,1),0).owner.inputs[0] is x
assert addbroadcast(unbroadcast(x,0),0) is x assert addbroadcast(unbroadcast(x,0),0) is x
def test_mod():
"""
We add this test as not all language and C implementation give the same
signe to the result. This check that the c_code of `Mod` is implemented
as Python. That is what we want.
"""
x, y = fscalars('xy')
fn = gof.DualLinker().accept(gof.Env([x,y], [x%y])).make_function()
for a,b in ((0,1), (1,1), (0,-1), (1,-1), (-1,-1),
(1,2), (-1,2), (1,-2), (-1,-2),
(5,3), (-5,3), (5,-3), (-5,-3)
):
assert fn(a,b) == a%b, (a,)
if __name__ == '__main__': if __name__ == '__main__':
if 1: if 1:
unittest.main() unittest.main()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论