Example #1
0
def test_lpa_u2i(arrow_property_graph_lpa_u2i):
    ret = (lpa_u2i(arrow_property_graph_lpa_u2i, max_round=20).to_dataframe({
        "node":
        "v:v0.id",
        "label0":
        "r:v0.label_0",
        "label1":
        "r:v0.label_1"
    }).sort_values(by=["node"]))
Example #2
0
def test_error_on_add_column(arrow_property_graph_lpa_u2i):
    property_context = lpa_u2i(arrow_property_graph_lpa_u2i, max_round=20)

    with pytest.raises(KeyError, match="non_exist_label"):
        out = arrow_property_graph_lpa_u2i.add_column(
            property_context,
            {"id": "v:non_exist_label.id", "result": "r:non_exist_label.age"},
        )

    with pytest.raises(KeyError, match="non_exist_prop"):
        out = arrow_property_graph_lpa_u2i.add_column(
            property_context, {"id": "v:v0.non_exist_prop"}
        )

    with pytest.raises(AssertionError, match="selector of add column must be a dict"):
        out = arrow_property_graph_lpa_u2i.add_column(property_context, selector=None)

    with pytest.raises(SyntaxError, match="Invalid selector"):
        out = arrow_property_graph_lpa_u2i.add_column(
            property_context, {"id": "xxx:a.b"}
        )
Example #3
0
def test_error_on_selector(arrow_property_graph_lpa_u2i):
    property_context = lpa_u2i(arrow_property_graph_lpa_u2i, max_round=20)
    with pytest.raises(KeyError, match="non_exist_label"):
        out = property_context.to_numpy("v:non_exist_label.id")
    with pytest.raises(KeyError, match="non_exist_prop"):
        out = property_context.to_numpy("v:v0.non_exist_prop")
    with pytest.raises(
            InvalidArgumentError,
            match="Selector in labeled vertex property context cannot be None",
    ):
        out = property_context.to_numpy(selector=None)
    with pytest.raises(
            SyntaxError,
            match=
            "Invalid selector: `xxx`. Please inspect the result with `ret.schema` and choose a valid selector",
    ):
        out = property_context.to_numpy("xxx")
    with pytest.raises(
            SyntaxError,
            match=
            "Invalid selector: `xxx:a.b`. Please inspect the result with `ret.schema` and choose a valid selector",
    ):
        out = property_context.to_numpy("xxx:a.b")