Esempio n. 1
0
def test_relate_pattern():
    g = pygeos.linestrings([(0, 0), (1, 0), (1, 1)])
    polygon = pygeos.box(0, 0, 2, 2)
    assert pygeos.relate(g, polygon) == "11F00F212"
    assert pygeos.relate_pattern(g, polygon, "11F00F212")
    assert pygeos.relate_pattern(g, polygon, "*********")
    assert not pygeos.relate_pattern(g, polygon, "F********")
Esempio n. 2
0
def test_relate_pattern_non_scalar():
    with pytest.raises(ValueError, match="only supports scalar"):
        pygeos.relate_pattern([point] * 2, polygon, ["*********"] * 2)
Esempio n. 3
0
def test_relate_pattern_non_string(pattern):
    with pytest.raises(TypeError, match="expected string"):
        pygeos.relate_pattern(point, polygon, pattern)
Esempio n. 4
0
def test_relate_pattern_incorrect_length():
    with pytest.raises(pygeos.GEOSException, match="Should be length 9"):
        pygeos.relate_pattern(point, polygon, "**")

    with pytest.raises(pygeos.GEOSException, match="Should be length 9"):
        pygeos.relate_pattern(point, polygon, "**********")
Esempio n. 5
0
def test_relate_pattern_none(g1, g2):
    assert pygeos.relate_pattern(g1, g2, "*" * 9).item() is False
Esempio n. 6
0
def test_relate_pattern_empty():
    assert pygeos.relate_pattern(empty, empty, "*" * 9).item() is True