def test_filter_exr(): result = filter_expr(nodeset_literal([ROOT, CHILD1]), predicates([predicate(TRUE)]) ).evaluate_as_nodeset(CONTEXT) _check_nodeset_result(result, datatypes.nodeset([ROOT, CHILD1])) result = filter_expr(nodeset_literal([ROOT, CHILD1]), predicates([predicate(FALSE)]) ).evaluate_as_nodeset(CONTEXT) _check_nodeset_result(result, datatypes.nodeset())
def test_filter_exr(): result = filter_expr(nodeset_literal([ROOT, CHILD1]), predicates([predicate(TRUE) ])).evaluate_as_nodeset(CONTEXT) _check_nodeset_result(result, datatypes.nodeset([ROOT, CHILD1])) result = filter_expr(nodeset_literal([ROOT, CHILD1]), predicates([predicate(FALSE) ])).evaluate_as_nodeset(CONTEXT) _check_nodeset_result(result, datatypes.nodeset())
def test_predicate(): ctx = context(ROOT, 1, 1) for args, expected in ( # FIXME: test literal optimization # FIXME: test `position() = Expr` optimization # FIXME: test `position() [>,>=] Expr` optimization # FIXME: test `Expr [<,<=] position()` optimization # FIXME: test numeric-type expression # test boolean-type expression (and_expr(TRUE, 'and', FALSE), []), (or_expr(TRUE, 'or', FALSE), [ROOT]), # FIXME: test object-type expression ): result = predicate(args).select(ctx, [ROOT]) result = list(result) assert result == expected, (result, expected)