Unverified Commit 12f02c3c authored by Will's avatar Will Committed by GitHub
Browse files

Update heterograph.py (#6506)


Co-authored-by: default avatarHongzhi (Steve), Chen <chenhongzhi.nkcs@gmail.com>
parent c76a43ca
...@@ -6061,9 +6061,11 @@ class DGLGraph(object): ...@@ -6061,9 +6061,11 @@ class DGLGraph(object):
old_eframes = self._edge_frames old_eframes = self._edge_frames
self._node_frames = [fr.clone() for fr in self._node_frames] self._node_frames = [fr.clone() for fr in self._node_frames]
self._edge_frames = [fr.clone() for fr in self._edge_frames] self._edge_frames = [fr.clone() for fr in self._edge_frames]
yield try:
self._node_frames = old_nframes yield
self._edge_frames = old_eframes finally:
self._node_frames = old_nframes
self._edge_frames = old_eframes
def formats(self, formats=None): def formats(self, formats=None):
r"""Get a cloned graph with the specified allowed sparse format(s) or r"""Get a cloned graph with the specified allowed sparse format(s) or
......
...@@ -677,6 +677,19 @@ def test_local_scope(idtype): ...@@ -677,6 +677,19 @@ def test_local_scope(idtype):
foo(g) foo(g)
# test exception handling
def foo(g):
try:
with g.local_scope():
g.ndata["hh"] = F.ones((g.num_nodes(), 1))
# throw TypeError
1 + "1"
except TypeError:
pass
assert "hh" not in g.ndata
foo(g)
@parametrize_idtype @parametrize_idtype
def test_isolated_nodes(idtype): def test_isolated_nodes(idtype):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment