MCPcopy Index your code
hub / github.com/waleedka/hiddenlayer / test_regex

Method test_regex

tests/test_ge.py:200–221  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

198
199class TestTransforms(unittest.TestCase):
200 def test_regex(self):
201 g = hl.Graph()
202 a = hl.Node(uid="a", name="a", op="a")
203 b = hl.Node(uid="b", name="b", op="b")
204 c = hl.Node(uid="c", name="c", op="c")
205 d = hl.Node(uid="d", name="d", op="d")
206 g.add_node(a)
207 g.add_node(b)
208 g.add_node(c)
209 g.add_node(d)
210 g.add_edge(a, b)
211 g.add_edge(b, c)
212 g.add_edge(b, d)
213
214 t = ht.Rename(op=r"a", to="bbb")
215 g = t.apply(g)
216 self.assertEqual(g["a"].op, "bbb")
217
218 t = ht.Rename(op=r"b(.*)", to=r"x\1")
219 g = t.apply(g)
220 self.assertEqual(g["a"].op, "xbb")
221 self.assertEqual(g["b"].op, "x")
222
223 def test_fold(self):
224 g = hl.Graph()

Callers

nothing calls this directly

Calls 3

add_nodeMethod · 0.95
add_edgeMethod · 0.95
applyMethod · 0.95

Tested by

no test coverage detected