コード例 #1
0
def test_arithmetic_pow():
    result = parse(['>', ['^', ['get', 'size'], 2], 100])
    assert result == ast.GreaterThan(
        ast.Function(
            'pow',
            [ast.Attribute('size'), 2],
        ), 100)
コード例 #2
0
def test_arithmetic_abs():
    result = parse(['>', ['abs', ['get', 'delta']], 1])
    assert result == ast.GreaterThan(
        ast.Function(
            'abs',
            [
                ast.Attribute('delta'),
            ],
        ), 1)
コード例 #3
0
def test_arithmetic_max():
    result = parse(['>', ['max', ['get', 'wins'], ['get', 'ties']], 10])
    assert result == ast.GreaterThan(
        ast.Function(
            'max',
            [
                ast.Attribute('wins'),
                ast.Attribute('ties'),
            ],
        ), 10)
コード例 #4
0
def test_logical_all():
    result = parse([
        'all', ['>', ['get', 'height'], 50],
        ['==', ['get', 'type'], 'commercial'], ['get', 'occupied']
    ])
    assert result == ast.And(
        ast.And(ast.GreaterThan(
            ast.Attribute('height'),
            50,
        ), ast.Equal(ast.Attribute('type'), 'commercial')),
        ast.Attribute('occupied'))
コード例 #5
0
ファイル: test_v20.py プロジェクト: geopython/pygeofilter
def test_and():
    result = parse('''
    <fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema-datatypes">
      <fes:And>
        <fes:PropertyIsLessThan>
          <fes:ValueReference>attr</fes:ValueReference>
          <fes:Literal type="xsd:int">30</fes:Literal>
        </fes:PropertyIsLessThan>
        <fes:PropertyIsGreaterThan>
          <fes:ValueReference>attr</fes:ValueReference>
          <fes:Literal type="xsd:int">10</fes:Literal>
        </fes:PropertyIsGreaterThan>
      </fes:And>
    </fes:Filter>
    ''')
    assert result == ast.And(ast.LessThan(
        ast.Attribute('attr'),
        30,
    ), ast.GreaterThan(
        ast.Attribute('attr'),
        10,
    ))
コード例 #6
0
ファイル: test_parser.py プロジェクト: geopython/pygeofilter
def test_attribute_gt_literal():
    result = parse('{ "gt": [{ "property": "attr" }, 5]}')
    assert result == ast.GreaterThan(
        ast.Attribute('attr'),
        5.0,
    )
コード例 #7
0
ファイル: test_parser.py プロジェクト: geopython/pygeofilter
def test_attribute_gt_literal():
    result = parse('attr > 5')
    assert result == ast.GreaterThan(
        ast.Attribute('attr'),
        5.0,
    )
コード例 #8
0
def test_attribute_gt_literal():
    result = parse('[">", ["get", "attr"], 5]')
    assert result == ast.GreaterThan(
        ast.Attribute('attr'),
        5.0,
    )