File: test_sort.py

package info (click to toggle)
stac-pydantic 3.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 664 kB
  • sloc: python: 1,787; makefile: 4
file content (23 lines) | stat: -rw-r--r-- 619 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
import pytest
from pydantic import ValidationError

from stac_pydantic.api.search import ExtendedSearch


def test_api_sort_extension():
    ExtendedSearch(
        collections=["collection1", "collection2"],
        sortby=[
            {"field": "field1", "direction": "asc"},
            {"field": "field2", "direction": "desc"},
        ],
    )


def test_api_sort_extension_invalid():
    # Invalid sort direction
    with pytest.raises(ValidationError):
        ExtendedSearch(
            collections=["collection1", "collection2"],
            sortby=[{"field": "field1", "direction": "ascending"}],
        )