提交 59fd1f4b authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Added test_deepcopy_shared_container - Currently failing

上级 e033e46a
......@@ -318,6 +318,27 @@ class T_picklefunction(unittest.TestCase):
g(1, 2) # put them back in sync
self.failUnless(f(3) == g(3)) # They should be in sync again.
def test_deepcopy_shared_container(self):
# Ensure that shared containers remain shared after a deep copy.
a = T.scalar('a')
x,s = T.scalars('xs')
h = function([In(a, value = 0.0)], a)
f = function([x, In(a, value=h.container[a], implicit = True)], x + a)
try:
hc = copy.deepcopy(h)
fc = copy.deepcopy(f, memo = {id(h): hc})
except NotImplementedError, e:
if e[0].startswith('DebugMode is not picklable'):
return
else:
raise
h[a] = 1
hc[a] = 2
self.failUnless(f[a] == 1)
self.failUnless(fc[a] == 2)
def test_pickle(self):
a = T.scalar() # the a is for 'anonymous' (un-named).
x,s = T.scalars('xs')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论