|
|
@ -68,7 +68,7 @@ hotels = """
|
|
|
|
("some $i in //hotel/branch/staff satisfies $i/age < 20", "false"),
|
|
|
|
("some $i in //hotel/branch/staff satisfies $i/age < 20", "false"),
|
|
|
|
("every $i in /hotel/branch/staff satisfies $i/age > 20", "true"),
|
|
|
|
("every $i in /hotel/branch/staff satisfies $i/age > 20", "true"),
|
|
|
|
("every $i in //hotel/branch/staff satisfies $i/age > 20 ", "true"),
|
|
|
|
("every $i in //hotel/branch/staff satisfies $i/age > 20 ", "true"),
|
|
|
|
("let $x := hotel/branch[@location = 'California'], $y := hotel/branch[@location = 'Las Vegas'] return (avg($x/staff/age), avg($y/staff/age))", "27.5"),
|
|
|
|
("let $x := branch[@location = 'California'], $y := branch[@location = 'Las Vegas'] return (avg($x/staff/age), avg($y/staff/age))", "27.5"),
|
|
|
|
("let $x := //branch[@location = 'California'], $y := //branch[@location = 'Las Vegas'] return (avg($x/staff/age), avg($y/staff/age))", "27.5"),
|
|
|
|
("let $x := //branch[@location = 'California'], $y := //branch[@location = 'Las Vegas'] return (avg($x/staff/age), avg($y/staff/age))", "27.5"),
|
|
|
|
("let $nu := 1, $de := 1000 return 'probability = ' || $nu div $de * 100 || '%'", "0.1%"),
|
|
|
|
("let $nu := 1, $de := 1000 return 'probability = ' || $nu div $de * 100 || '%'", "0.1%"),
|
|
|
|
("let $nu := 2, $probability := function ($argument) { 'probability = ' || $nu div $argument * 100 || '%'}, $de := 5 return $probability($de)", "40%"),
|
|
|
|
("let $nu := 2, $probability := function ($argument) { 'probability = ' || $nu div $argument * 100 || '%'}, $de := 5 return $probability($de)", "40%"),
|
|
|
@ -99,45 +99,45 @@ branches_to_visit = """<?xml version="1.0" ?>
|
|
|
|
</branches_to_visit>"""
|
|
|
|
</branches_to_visit>"""
|
|
|
|
@pytest.mark.parametrize("html_content", [branches_to_visit])
|
|
|
|
@pytest.mark.parametrize("html_content", [branches_to_visit])
|
|
|
|
@pytest.mark.parametrize("xpath, answer", [
|
|
|
|
@pytest.mark.parametrize("xpath, answer", [
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch union branches_to_visit/manager[@name = 'Freya']/branch", "Area 51"),
|
|
|
|
("manager[@name = 'Godot']/branch union manager[@name = 'Freya']/branch", "Area 51"),
|
|
|
|
("//manager[@name = 'Godot']/branch union //manager[@name = 'Freya']/branch", "Stalsk12"),
|
|
|
|
("//manager[@name = 'Godot']/branch union //manager[@name = 'Freya']/branch", "Stalsk12"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch | branches_to_visit/manager[@name = 'Freya']/branch", "Stalsk12"),
|
|
|
|
("manager[@name = 'Godot']/branch | manager[@name = 'Freya']/branch", "Stalsk12"),
|
|
|
|
("//manager[@name = 'Godot']/branch | //manager[@name = 'Freya']/branch", "Stalsk12"),
|
|
|
|
("//manager[@name = 'Godot']/branch | //manager[@name = 'Freya']/branch", "Stalsk12"),
|
|
|
|
("branches_to_visit/manager/branch intersect branches_to_visit/manager[@name = 'Godot']/branch", "A place with no name"),
|
|
|
|
("manager/branch intersect manager[@name = 'Godot']/branch", "A place with no name"),
|
|
|
|
("//manager/branch intersect //manager[@name = 'Godot']/branch", "A place with no name"),
|
|
|
|
("//manager/branch intersect //manager[@name = 'Godot']/branch", "A place with no name"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch intersect branches_to_visit/manager[@name = 'Freya']/branch", ""),
|
|
|
|
("manager[@name = 'Godot']/branch intersect manager[@name = 'Freya']/branch", ""),
|
|
|
|
("branches_to_visit/manager/branch except branches_to_visit/manager[@name = 'Godot']/branch", "Barcelona"),
|
|
|
|
("manager/branch except manager[@name = 'Godot']/branch", "Barcelona"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch[1] eq 'Area 51'", "true"),
|
|
|
|
("manager[@name = 'Godot']/branch[1] eq 'Area 51'", "true"),
|
|
|
|
("//manager[@name = 'Godot']/branch[1] eq 'Area 51'", "true"),
|
|
|
|
("//manager[@name = 'Godot']/branch[1] eq 'Area 51'", "true"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch[1] eq 'Seoul'", "false"),
|
|
|
|
("manager[@name = 'Godot']/branch[1] eq 'Seoul'", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch[1] eq 'Seoul'", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch[1] eq 'Seoul'", "false"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch[2] eq branches_to_visit/manager[@name = 'Freya']/branch[2]", "false"),
|
|
|
|
("manager[@name = 'Godot']/branch[2] eq manager[@name = 'Freya']/branch[2]", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch[2] eq //manager[@name = 'Freya']/branch[2]", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch[2] eq //manager[@name = 'Freya']/branch[2]", "false"),
|
|
|
|
("branches_to_visit/manager[1]/@room_no lt branches_to_visit/manager[2]/@room_no", "false"),
|
|
|
|
("manager[1]/@room_no lt manager[2]/@room_no", "false"),
|
|
|
|
("//manager[1]/@room_no lt //manager[2]/@room_no", "false"),
|
|
|
|
("//manager[1]/@room_no lt //manager[2]/@room_no", "false"),
|
|
|
|
("branches_to_visit/manager[1]/@room_no gt branches_to_visit/manager[2]/@room_no", "true"),
|
|
|
|
("manager[1]/@room_no gt manager[2]/@room_no", "true"),
|
|
|
|
("//manager[1]/@room_no gt //manager[2]/@room_no", "true"),
|
|
|
|
("//manager[1]/@room_no gt //manager[2]/@room_no", "true"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch[1] = 'Area 51'", "true"),
|
|
|
|
("manager[@name = 'Godot']/branch[1] = 'Area 51'", "true"),
|
|
|
|
("//manager[@name = 'Godot']/branch[1] = 'Area 51'", "true"),
|
|
|
|
("//manager[@name = 'Godot']/branch[1] = 'Area 51'", "true"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch[1] = 'Seoul'", "false"),
|
|
|
|
("manager[@name = 'Godot']/branch[1] = 'Seoul'", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch[1] = 'Seoul'", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch[1] = 'Seoul'", "false"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch = 'Area 51'", "true"),
|
|
|
|
("manager[@name = 'Godot']/branch = 'Area 51'", "true"),
|
|
|
|
("//manager[@name = 'Godot']/branch = 'Area 51'", "true"),
|
|
|
|
("//manager[@name = 'Godot']/branch = 'Area 51'", "true"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch = 'Barcelona'", "false"),
|
|
|
|
("manager[@name = 'Godot']/branch = 'Barcelona'", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch = 'Barcelona'", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch = 'Barcelona'", "false"),
|
|
|
|
("branches_to_visit/manager[1]/@room_no > branches_to_visit/manager[2]/@room_no", "true"),
|
|
|
|
("manager[1]/@room_no > manager[2]/@room_no", "true"),
|
|
|
|
("//manager[1]/@room_no > //manager[2]/@room_no", "true"),
|
|
|
|
("//manager[1]/@room_no > //manager[2]/@room_no", "true"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch[ . = 'Stalsk12'] is branches_to_visit/manager[1]/branch[1]", "false"),
|
|
|
|
("manager[@name = 'Godot']/branch[ . = 'Stalsk12'] is manager[1]/branch[1]", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch[ . = 'Stalsk12'] is //manager[1]/branch[1]", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch[ . = 'Stalsk12'] is //manager[1]/branch[1]", "false"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch[ . = 'Stalsk12'] is branches_to_visit/manager[1]/branch[3]", "true"),
|
|
|
|
("manager[@name = 'Godot']/branch[ . = 'Stalsk12'] is manager[1]/branch[3]", "true"),
|
|
|
|
("//manager[@name = 'Godot']/branch[ . = 'Stalsk12'] is //manager[1]/branch[3]", "true"),
|
|
|
|
("//manager[@name = 'Godot']/branch[ . = 'Stalsk12'] is //manager[1]/branch[3]", "true"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch[ . = 'Stalsk12'] << branches_to_visit/manager[1]/branch[1]", "false"),
|
|
|
|
("manager[@name = 'Godot']/branch[ . = 'Stalsk12'] << manager[1]/branch[1]", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch[ . = 'Stalsk12'] << //manager[1]/branch[1]", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch[ . = 'Stalsk12'] << //manager[1]/branch[1]", "false"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch[ . = 'Stalsk12'] >> branches_to_visit/manager[1]/branch[1]", "true"),
|
|
|
|
("manager[@name = 'Godot']/branch[ . = 'Stalsk12'] >> manager[1]/branch[1]", "true"),
|
|
|
|
("//manager[@name = 'Godot']/branch[ . = 'Stalsk12'] >> //manager[1]/branch[1]", "true"),
|
|
|
|
("//manager[@name = 'Godot']/branch[ . = 'Stalsk12'] >> //manager[1]/branch[1]", "true"),
|
|
|
|
("branches_to_visit/manager[@name = 'Godot']/branch[ . = 'Stalsk12'] is branches_to_visit/manager[@name = 'Freya']/branch[ . = 'Stalsk12']", "false"),
|
|
|
|
("manager[@name = 'Godot']/branch[ . = 'Stalsk12'] is manager[@name = 'Freya']/branch[ . = 'Stalsk12']", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch[ . = 'Stalsk12'] is //manager[@name = 'Freya']/branch[ . = 'Stalsk12']", "false"),
|
|
|
|
("//manager[@name = 'Godot']/branch[ . = 'Stalsk12'] is //manager[@name = 'Freya']/branch[ . = 'Stalsk12']", "false"),
|
|
|
|
("branches_to_visit/manager[1]/@name || branches_to_visit/manager[2]/@name", "GodotFreya"),
|
|
|
|
("manager[1]/@name || manager[2]/@name", "GodotFreya"),
|
|
|
|
("//manager[1]/@name || //manager[2]/@name", "GodotFreya"),
|
|
|
|
("//manager[1]/@name || //manager[2]/@name", "GodotFreya"),
|
|
|
|
])
|
|
|
|
])
|
|
|
|
def test_branches_to_visit(html_content, xpath, answer):
|
|
|
|
def test_branches_to_visit(html_content, xpath, answer):
|
|
|
@ -170,10 +170,10 @@ trips = """
|
|
|
|
("(1 + 9 * 9 + 5) div 6", "14.5"),
|
|
|
|
("(1 + 9 * 9 + 5) div 6", "14.5"),
|
|
|
|
("23 idiv 3", "7"),
|
|
|
|
("23 idiv 3", "7"),
|
|
|
|
("23 div 3", "7.66666666"),
|
|
|
|
("23 div 3", "7.66666666"),
|
|
|
|
("for $i in ./trips/trip return $i/traveler/duration * $i/traveler/price", "21002.04"),
|
|
|
|
("for $i in ./trip return $i/traveler/duration * $i/traveler/price", "21002.04"),
|
|
|
|
("for $i in ./trips/trip return $i/traveler/duration ", "4"),
|
|
|
|
("for $i in ./trip return $i/traveler/duration ", "4"),
|
|
|
|
("for $i in .//trip return $i/traveler/duration * $i/traveler/price", "21002.04"),
|
|
|
|
("for $i in .//trip return $i/traveler/duration * $i/traveler/price", "21002.04"),
|
|
|
|
("sum(for $i in ./trips/trip return $i/traveler/duration * $i/traveler/price)", "29002.04"),
|
|
|
|
("sum(for $i in ./trip return $i/traveler/duration * $i/traveler/price)", "29002.04"),
|
|
|
|
("sum(for $i in .//trip return $i/traveler/duration * $i/traveler/price)", "29002.04"),
|
|
|
|
("sum(for $i in .//trip return $i/traveler/duration * $i/traveler/price)", "29002.04"),
|
|
|
|
#("trip[1]/depart - trip[1]/arrive", "fail_to_get_answer"),
|
|
|
|
#("trip[1]/depart - trip[1]/arrive", "fail_to_get_answer"),
|
|
|
|
#("//trip[1]/depart - //trip[1]/arrive", "fail_to_get_answer"),
|
|
|
|
#("//trip[1]/depart - //trip[1]/arrive", "fail_to_get_answer"),
|
|
|
|