-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
65 lines (44 loc) · 1.52 KB
/
conftest.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from pathlib import Path
from typing import Tuple
import geopandas as gpd
import pandas as pd
import pytest
import shapely
@pytest.fixture(scope="package")
def cell_gson() -> gpd.GeoDataFrame:
"""Return a path to directory with a few test images."""
path = Path().resolve()
path = path / "tests/data/test_cells.json"
df = pd.read_json(path)
df["geometry"] = df["geometry"].apply(shapely.geometry.shape)
df = gpd.GeoDataFrame(df).set_geometry("geometry")
df["class_name"] = df["properties"].apply(lambda x: x["classification"]["name"])
return df
@pytest.fixture(scope="package")
def cells_and_areas() -> Tuple[gpd.GeoDataFrame, gpd.GeoDataFrame]:
path = Path().resolve()
path_cells = path / "tests/data/test_cells.feather"
path_areas = path / "tests/data/test_area.feather"
cells = gpd.read_feather(path_cells)
areas = gpd.read_feather(path_areas)
return cells, areas
@pytest.fixture(scope="package")
def merge_data_cell() -> Path:
path = Path().resolve()
path = path / "tests/data/merge_data/cell"
return path
@pytest.fixture(scope="package")
def merge_data_area() -> Path:
path = Path().resolve()
path = path / "tests/data/merge_data/area"
return path
@pytest.fixture(scope="package")
def pipeline_areas() -> Path:
path = Path().resolve()
path = path / "tests/data/pipeline/areas"
return path
@pytest.fixture(scope="package")
def pipeline_cells() -> Path:
path = Path().resolve()
path = path / "tests/data/pipeline/cells"
return path