def test_shared_state_not_implicit(self):
# This test is taken from the documentation in
# doc/topics/function.txt. If it does not pass anymore and yet the
# behavior is still intended the doc and the test should both be
# updated accordingly.
x, s = T.scalars('xs')
inc = function([x, In(s, update=(s + x), value=10.0)], [])
dec = function([x, In(s, update=(s - x), value=inc.container[s],
implicit=False)], [])
self.assertTrue(dec[s] is inc[s])
inc[s] = 2
self.assertTrue(dec[s] == 2)
dec(1)
self.assertTrue(inc[s] == 1)
dec(1, 0)
self.assertTrue(inc[s] == -1)
self.assertTrue(dec[s] == -1)
test_function_module.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录