def test_seed_type_str_to_ntypes():
    """Convert etype from string to tuple."""
    # Test for node pairs.
    seed_type_str = "user:like:item"
    seed_size = 2
    node_type = gb.seed_type_str_to_ntypes(seed_type_str, seed_size)
    assert node_type == ["user", "item"]

    # Test for node pairs.
    seed_type_str = "user:item:user"
    seed_size = 3
    node_type = gb.seed_type_str_to_ntypes(seed_type_str, seed_size)
    assert node_type == ["user", "item", "user"]

    # Test for unexpected input: list.
    seed_type_str = ["user", "item"]
    with pytest.raises(
        AssertionError,
        match=re.escape(
            "Passed-in seed type should be string, but got <class 'list'>"
        ),
    ):
        _ = gb.seed_type_str_to_ntypes(seed_type_str, 2)
Convert etype from string to tuple.
tests/python/pytorch/graphbolt/test_base.py