def get_search_object(self):
        """Get an instance of the search object for this type.

        Returns
        -------
        pydov.search.interpretaties.QuartairStratigrafieSearch
            Instance of QuartairStratigrafieSearch used for searching.

        """
        return QuartairStratigrafieSearch()
class TestQuartairStratigrafieSearch(AbstractTestSearch):

    search_instance = QuartairStratigrafieSearch()
    datatype_class = QuartairStratigrafie

    valid_query_single = PropertyIsEqualTo(propertyname='Proefnummer',
                                           literal='GEO-42/190-B14')

    inexistent_field = 'onbestaand'
    wfs_field = 'Proefnummer'
    xml_field = 'diepte_laag_van'

    valid_returnfields = ('pkey_interpretatie',
                          'betrouwbaarheid_interpretatie')
    valid_returnfields_subtype = ('pkey_interpretatie', 'diepte_laag_van',
                                  'diepte_laag_tot')
    valid_returnfields_extra = ('pkey_interpretatie', 'gemeente')

    df_default_columns = [
        'pkey_interpretatie', 'pkey_boring', 'betrouwbaarheid_interpretatie',
        'x', 'y', 'diepte_laag_van', 'diepte_laag_tot', 'lid1',
        'relatie_lid1_lid2', 'lid2'
    ]

    def test_search_customreturnfields(self, mp_get_schema,
                                       mp_remote_describefeaturetype,
                                       mp_remote_wfs_feature, mp_dov_xml):
        """Test the search method with custom return fields.

        Test whether the output dataframe is correct.

        Parameters
        ----------
        mp_get_schema : pytest.fixture
            Monkeypatch the call to a remote OWSLib schema.
        mp_remote_describefeaturetype : pytest.fixture
            Monkeypatch the call to a remote DescribeFeatureType .
        mp_remote_wfs_feature : pytest.fixture
            Monkeypatch the call to get WFS features.
        mp_dov_xml : pytest.fixture
            Monkeypatch the call to get the remote XML data.

        """
        df = self.search_instance.search(query=self.valid_query_single,
                                         return_fields=(
                                             'pkey_interpretatie',
                                             'pkey_boring',
                                         ))

        assert isinstance(df, DataFrame)

        assert list(df) == [
            'pkey_interpretatie',
            'pkey_boring',
        ]

    def test_search_xml_resolve(self, mp_get_schema,
                                mp_remote_describefeaturetype,
                                mp_remote_wfs_feature, mp_dov_xml):
        """Test the search method with return fields from XML but not from a
        subtype.

        Test whether the output dataframe contains the resolved XML data.

        Parameters
        ----------
        mp_get_schema : pytest.fixture
            Monkeypatch the call to a remote OWSLib schema.
        mp_remote_describefeaturetype : pytest.fixture
            Monkeypatch the call to a remote DescribeFeatureType.
        mp_remote_wfs_feature : pytest.fixture
            Monkeypatch the call to get WFS features.
        mp_dov_xml : pytest.fixture
            Monkeypatch the call to get the remote XML data.

        """
        df = self.search_instance.search(query=self.valid_query_single,
                                         return_fields=('pkey_interpretatie',
                                                        'diepte_laag_tot'))

        assert df.diepte_laag_tot[0] == 8.0
Esempio n. 3
0
    InformeleHydrogeologischeStratigrafieSearch, InformeleStratigrafieSearch,
    LithologischeBeschrijvingenSearch, QuartairStratigrafieSearch)
from pydov.search.sondering import SonderingSearch
from pydov.util.errors import InvalidSearchParameterError
from pydov.util.location import Point, WithinDistance
from tests.abstract import service_ok

search_objects = [
    BoringSearch(),
    SonderingSearch(),
    GrondwaterFilterSearch(),
    GrondwaterMonsterSearch(),
    FormeleStratigrafieSearch(),
    InformeleHydrogeologischeStratigrafieSearch(),
    GeotechnischeCoderingSearch(),
    QuartairStratigrafieSearch(),
    InformeleStratigrafieSearch(),
    HydrogeologischeStratigrafieSearch(),
    GecodeerdeLithologieSearch(),
    LithologischeBeschrijvingenSearch(),
    GrondmonsterSearch()
]


@pytest.mark.parametrize("objectsearch", search_objects)
def test_get_description(mp_wfs, objectsearch):
    """Test the get_description method.

    Test whether the method returns a non-empty string.

    Parameters