File: test_driver_options.py

package info (click to toggle)
fiona 1.10.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,660 kB
  • sloc: python: 12,616; makefile: 214; sh: 45
file content (34 lines) | stat: -rw-r--r-- 896 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import glob
import os
import tempfile

import fiona
from fiona.model import Feature

from .conftest import get_temp_filename, requires_gdal2


def test_gml_format_option(tmp_path):
    """Test GML dataset creation option FORMAT (see gh-968)"""

    schema = {"geometry": "Point", "properties": {"position": "int"}}
    records = [
        Feature.from_dict(
            **{
                "geometry": {"type": "Point", "coordinates": (0.0, float(i))},
                "properties": {"position": i},
            }
        )
        for i in range(10)
    ]

    fpath = tmp_path.joinpath(get_temp_filename("GML"))

    with fiona.open(fpath, "w", driver="GML", schema=schema, FORMAT="GML3") as out:
        out.writerecords(records)

    xsd_path = list(tmp_path.glob("*.xsd"))[0]

    with open(xsd_path) as f:
        xsd = f.read()
        assert "http://schemas.opengis.net/gml/3.1.1" in xsd