diff --git a/test/unit/test_graph_selection.py b/test/unit/test_graph_selection.py index 572c8fed10d..9bb563a0e9d 100644 --- a/test/unit/test_graph_selection.py +++ b/test/unit/test_graph_selection.py @@ -97,6 +97,7 @@ def id_macro(arg): (["1+Y.f"], [], {"m.X.c", "m.Y.f"}), # childrens parents (["@X.c"], [], {"m.X.a", "m.X.c", "m.Y.f", "m.X.g"}), + (["1@X.c"], [], {"m.X.a", "m.X.c", "m.Y.f", "m.X.g"}), # multiple selection/exclusion (["tag:abc", "tag:bcef"], [], {"m.X.a", "m.Y.b", "m.X.c", "m.X.e", "m.Y.f"}), (["tag:abc", "tag:bcef"], ["tag:efg"], {"m.X.a", "m.Y.b", "m.X.c"}), @@ -138,48 +139,51 @@ def test_run_specs(include, exclude, expected): param_specs = [ - ("a", False, None, False, None, "fqn", "a", False), - ("+a", True, None, False, None, "fqn", "a", False), - ("256+a", True, 256, False, None, "fqn", "a", False), - ("a+", False, None, True, None, "fqn", "a", False), - ("a+256", False, None, True, 256, "fqn", "a", False), - ("+a+", True, None, True, None, "fqn", "a", False), - ("16+a+32", True, 16, True, 32, "fqn", "a", False), - ("@a", False, None, False, None, "fqn", "a", True), - ("a.b", False, None, False, None, "fqn", "a.b", False), - ("+a.b", True, None, False, None, "fqn", "a.b", False), - ("256+a.b", True, 256, False, None, "fqn", "a.b", False), - ("a.b+", False, None, True, None, "fqn", "a.b", False), - ("a.b+256", False, None, True, 256, "fqn", "a.b", False), - ("+a.b+", True, None, True, None, "fqn", "a.b", False), - ("16+a.b+32", True, 16, True, 32, "fqn", "a.b", False), - ("@a.b", False, None, False, None, "fqn", "a.b", True), - ("a.b.*", False, None, False, None, "fqn", "a.b.*", False), - ("+a.b.*", True, None, False, None, "fqn", "a.b.*", False), - ("256+a.b.*", True, 256, False, None, "fqn", "a.b.*", False), - ("a.b.*+", False, None, True, None, "fqn", "a.b.*", False), - ("a.b.*+256", False, None, True, 256, "fqn", "a.b.*", False), - ("+a.b.*+", True, None, True, None, "fqn", "a.b.*", False), - ("16+a.b.*+32", True, 16, True, 32, "fqn", "a.b.*", False), - ("@a.b.*", False, None, False, None, "fqn", "a.b.*", True), - ("tag:a", False, None, False, None, "tag", "a", False), - ("+tag:a", True, None, False, None, "tag", "a", False), - ("256+tag:a", True, 256, False, None, "tag", "a", False), - ("tag:a+", False, None, True, None, "tag", "a", False), - ("tag:a+256", False, None, True, 256, "tag", "a", False), - ("+tag:a+", True, None, True, None, "tag", "a", False), - ("16+tag:a+32", True, 16, True, 32, "tag", "a", False), - ("@tag:a", False, None, False, None, "tag", "a", True), - ("source:a", False, None, False, None, "source", "a", False), - ("source:a+", False, None, True, None, "source", "a", False), - ("source:a+1", False, None, True, 1, "source", "a", False), - ("source:a+32", False, None, True, 32, "source", "a", False), - ("@source:a", False, None, False, None, "source", "a", True), + ("a", False, None, False, None, "fqn", "a", False, None), + ("+a", True, None, False, None, "fqn", "a", False, None), + ("256+a", True, 256, False, None, "fqn", "a", False, None), + ("a+", False, None, True, None, "fqn", "a", False, None), + ("a+256", False, None, True, 256, "fqn", "a", False, None), + ("+a+", True, None, True, None, "fqn", "a", False, None), + ("16+a+32", True, 16, True, 32, "fqn", "a", False, None), + ("@a", False, None, False, None, "fqn", "a", True, None), + ("20@a", False, None, False, None, "fqn", "a", True, 20), + ("a.b", False, None, False, None, "fqn", "a.b", False, None), + ("+a.b", True, None, False, None, "fqn", "a.b", False, None), + ("256+a.b", True, 256, False, None, "fqn", "a.b", False, None), + ("a.b+", False, None, True, None, "fqn", "a.b", False, None), + ("a.b+256", False, None, True, 256, "fqn", "a.b", False, None), + ("+a.b+", True, None, True, None, "fqn", "a.b", False, None), + ("16+a.b+32", True, 16, True, 32, "fqn", "a.b", False, None), + ("@a.b", False, None, False, None, "fqn", "a.b", True, None), + ("5@a.b", False, None, False, None, "fqn", "a.b", True, 5), + ("a.b.*", False, None, False, None, "fqn", "a.b.*", False, None), + ("+a.b.*", True, None, False, None, "fqn", "a.b.*", False, None), + ("256+a.b.*", True, 256, False, None, "fqn", "a.b.*", False, None), + ("a.b.*+", False, None, True, None, "fqn", "a.b.*", False, None), + ("a.b.*+256", False, None, True, 256, "fqn", "a.b.*", False, None), + ("+a.b.*+", True, None, True, None, "fqn", "a.b.*", False, None), + ("16+a.b.*+32", True, 16, True, 32, "fqn", "a.b.*", False, None), + ("@a.b.*", False, None, False, None, "fqn", "a.b.*", True, None), + ("12@a.b.*", False, None, False, None, "fqn", "a.b.*", True, 12), + ("tag:a", False, None, False, None, "tag", "a", False, None), + ("+tag:a", True, None, False, None, "tag", "a", False, None), + ("256+tag:a", True, 256, False, None, "tag", "a", False, None), + ("tag:a+", False, None, True, None, "tag", "a", False, None), + ("tag:a+256", False, None, True, 256, "tag", "a", False, None), + ("+tag:a+", True, None, True, None, "tag", "a", False, None), + ("16+tag:a+32", True, 16, True, 32, "tag", "a", False, None), + ("3@tag:a", False, None, False, None, "tag", "a", True, 3), + ("source:a", False, None, False, None, "source", "a", False, None), + ("source:a+", False, None, True, None, "source", "a", False, None), + ("source:a+1", False, None, True, 1, "source", "a", False, None), + ("source:a+32", False, None, True, 32, "source", "a", False, None), + ("1@source:a", False, None, False, None, "source", "a", True, 1), ] @pytest.mark.parametrize( - "spec,parents,parents_depth,children,children_depth,filter_type,filter_value,childrens_parents", + "spec,parents,parents_depth,children,children_depth,filter_type,filter_value,childrens_parents,childrens_parents_depth", param_specs, ids=id_macro, ) @@ -192,6 +196,7 @@ def test_parse_specs( filter_type, filter_value, childrens_parents, + childrens_parents_depth ): parsed = graph_selector.SelectionCriteria.from_single_spec(spec) assert parsed.parents == parents @@ -201,6 +206,7 @@ def test_parse_specs( assert parsed.method == filter_type assert parsed.value == filter_value assert parsed.childrens_parents == childrens_parents + assert parsed.childrens_parents_depth == childrens_parents_depth invalid_specs = [ diff --git a/test/unit/test_graph_selector_spec.py b/test/unit/test_graph_selector_spec.py index 8a19a8b5934..69aed2d9b92 100644 --- a/test/unit/test_graph_selector_spec.py +++ b/test/unit/test_graph_selector_spec.py @@ -23,6 +23,7 @@ def test_raw_parse_simple(): assert not result.parents assert result.parents_depth is None assert result.children_depth is None + assert result.childrens_parents_depth is None def test_raw_parse_simple_infer_path(): @@ -37,6 +38,7 @@ def test_raw_parse_simple_infer_path(): assert not result.parents assert result.parents_depth is None assert result.children_depth is None + assert result.childrens_parents_depth is None def test_raw_parse_simple_infer_path_modified(): @@ -51,6 +53,22 @@ def test_raw_parse_simple_infer_path_modified(): assert not result.parents assert result.parents_depth is None assert result.children_depth is None + assert result.childrens_parents_depth is None + + +def test_raw_parse_simple_infer_fqn_childrens_parents(): + raw = "1@asdf" + result = SelectionCriteria.from_single_spec(raw) + assert result.raw == raw + assert result.method == MethodName.FQN + assert result.method_arguments == [] + assert result.value == "asdf" + assert result.childrens_parents + assert not result.children + assert not result.parents + assert result.parents_depth is None + assert result.children_depth is None + assert result.childrens_parents_depth == 1 def test_raw_parse_simple_infer_fqn_parents(): @@ -65,6 +83,7 @@ def test_raw_parse_simple_infer_fqn_parents(): assert result.parents assert result.parents_depth is None assert result.children_depth is None + assert result.childrens_parents_depth is None def test_raw_parse_simple_infer_fqn_children(): @@ -79,6 +98,7 @@ def test_raw_parse_simple_infer_fqn_children(): assert not result.parents assert result.parents_depth is None assert result.children_depth is None + assert result.childrens_parents_depth is None def test_raw_parse_complex(): @@ -93,6 +113,7 @@ def test_raw_parse_complex(): assert result.parents assert result.parents_depth == 2 assert result.children_depth == 4 + assert result.childrens_parents_depth is None def test_raw_parse_weird(): @@ -108,6 +129,7 @@ def test_raw_parse_weird(): assert not result.parents assert result.parents_depth is None assert result.children_depth is None + assert result.childrens_parents_depth is None def test_raw_parse_invalid():