예제 #1
0
def test_handle_to_from_string():
    handle = NodeHandle("baz", NodeHandle("bar", NodeHandle("foo", None)))
    assert handle.to_string() == "foo.bar.baz"
    assert NodeHandle.from_string(handle.to_string()) == handle

    handle = NodeHandle("foo", None)
    assert handle.to_string() == "foo"
    assert NodeHandle.from_string(handle.to_string()) == handle
예제 #2
0
 def __new__(cls, solid_handle: NodeHandle, key: Optional[str] = None):
     return super(StepHandle, cls).__new__(
         cls,
         solid_handle=check.inst_param(solid_handle, "solid_handle",
                                       NodeHandle),
         # mypy can't tell that if default is set, this is guaranteed to be a str
         key=cast(
             str,
             check.opt_str_param(key,
                                 "key",
                                 default=solid_handle.to_string())),
     )