Skip to content

Commit

Permalink
test(CoordinatesFilter): mock coordinates filters (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsmrynk authored Apr 29, 2024
1 parent ca0b5c1 commit ee7c839
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions src/data/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from pathlib import Path
from unittest.mock import patch
from unittest.mock import MagicMock, patch

import geopandas as gpd
import numpy as np
import pytest

from src.data.coordinates_filter import (
CompositeFilter,
CoordinatesFilter,
DuplicatesFilter,
GeospatialFilter,
MaskFilter,
Expand All @@ -25,12 +26,10 @@

@pytest.fixture(scope='session')
def composite_filter() -> CompositeFilter:
mask = np.array([0, 1, 0, 1], dtype=np.bool_)
coordinates_filters = [
DuplicatesFilter(),
MaskFilter(
mask=mask,
),
MagicMock(spec=CoordinatesFilter),
MagicMock(spec=CoordinatesFilter),
MagicMock(spec=CoordinatesFilter),
]
return CompositeFilter(
coordinates_filters=coordinates_filters,
Expand Down
11 changes: 5 additions & 6 deletions src/data/tests/test_coordinates_filter.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from unittest.mock import patch
from unittest.mock import MagicMock, patch

import geopandas as gpd
import geopandas.testing
import numpy as np

from src.data.coordinates_filter import (
CompositeFilter,
CoordinatesFilter,
DuplicatesFilter,
GeospatialFilter,
MaskFilter,
Expand All @@ -18,12 +19,10 @@


def test_init_composite_filter() -> None:
mask = np.array([0, 1, 0, 1], dtype=np.bool_)
coordinates_filters = [
DuplicatesFilter(),
MaskFilter(
mask=mask,
),
MagicMock(spec=CoordinatesFilter),
MagicMock(spec=CoordinatesFilter),
MagicMock(spec=CoordinatesFilter),
]
composite_filter = CompositeFilter(
coordinates_filters=coordinates_filters,
Expand Down

0 comments on commit ee7c839

Please sign in to comment.