Exemple #1
0
def test_any():
    f1 = ["==", "class", "address"]
    f2 = ["!=", "name", "hello world"]
    rule = get_qgis_rule(["any", f1, f2], escape_result=False)
    assert rule == """"class" is not null and "class" = \'address\' or "name" is null or "name" != \'hello world\'"""
def test_filter_depth():
    highway_primary_casing = get_qgis_rule(_highway_primary_casing,
                                           escape_result=False)
    highway_primary = get_qgis_rule(_highway_primary, escape_result=False)
    assert highway_primary_casing == highway_primary
Exemple #3
0
def test_has_not():
    expr = get_qgis_rule(["!has", "name"], escape_result=False)
    assert expr == "attribute($currentfeature, 'name') is null"
Exemple #4
0
def test_all():
    f1 = ["==", "class", "address"]
    f2 = ["!=", "name", "hello world"]
    f3 = [">=", "height", "123"]
    rule = get_qgis_rule(["all", f1, f2, f3], escape_result=False)
    assert rule == """("class" is not null and "class" = \'address\') and ("name" is null or "name" != \'hello world\') and ("height" is not null and "height" >= \'123\')"""
Exemple #5
0
def test_membership_not_in():
    expr = get_qgis_rule(["!in", "class", "city", "cafe", "poi"],
                         escape_result=False)
    assert expr == "(\"class\" is null or \"class\" not in ('city', 'cafe', 'poi'))"
Exemple #6
0
def test_lt_filter():
    rule = get_qgis_rule(["<", "class", "address"], escape_result=False)
    assert rule == "\"class\" is not null and \"class\" < 'address'"
Exemple #7
0
def test_neq_filter():
    rule = get_qgis_rule(["!=", "class", "address"], escape_result=False)
    assert rule == "\"class\" is null or \"class\" != 'address'"
Exemple #8
0
def test_type_comparision():
    rule = get_qgis_rule(["==", "$type", "Polygon"], escape_result=False)
    assert rule is None
Exemple #9
0
def test_qgis_attribute():
    rule = get_qgis_rule(["<=", "@map_scale", "20000"], escape_result=False)
    assert rule == "@map_scale is not null and @map_scale <= '20000'"