Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Make `get_collection` raise if `collection_id` is empty ([#809](https://github.com/stac-utils/pystac-client/pull/809))

### Added

- Add comprehensive test coverage for ConformanceClasses enum ([#834](https://github.com/stac-utils/pystac-client/pull/834))

### Documentation

- Update contributing guide to consistently use `uv` workflow ([#822](https://github.com/stac-utils/pystac-client/pull/822))
- Fix format script to use `ruff-format` instead of deprecated `black` hook ([#822](https://github.com/stac-utils/pystac-client/pull/822))
- Add "How to..." section to usage documentation with latest datetime search across multiple collections example ([#823](https://github.com/stac-utils/pystac-client/pull/823))


## [v0.9.0] - 2025-07-17

### Added
Expand Down
32 changes: 32 additions & 0 deletions tests/test_conformance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import pytest

from pystac_client.conformance import ConformanceClasses


class TestConformanceClasses:
def test_get_by_name_raises_for_invalid_names(self) -> None:
"""Test get_by_name raises ValueError for invalid conformance class names."""
with pytest.raises(ValueError, match="Invalid conformance class 'invalid'"):
ConformanceClasses.get_by_name("invalid")

with pytest.raises(ValueError, match="Invalid conformance class 'nonexistent'"):
ConformanceClasses.get_by_name("nonexistent")

with pytest.raises(ValueError, match="Invalid conformance class ''"):
ConformanceClasses.get_by_name("")

def test_get_by_name_valid(self) -> None:
"""Test get_by_name with valid conformance class names."""
assert ConformanceClasses.get_by_name("core") == ConformanceClasses.CORE
assert ConformanceClasses.get_by_name("CORE") == ConformanceClasses.CORE

def test_valid_uri_property(self) -> None:
"""Test valid_uri property returns correct URI pattern."""
assert (
ConformanceClasses.CORE.valid_uri == "https://api.stacspec.org/v1.0.*/core"
)

def test_pattern_property(self) -> None:
"""Test pattern property returns compiled regex."""
core_pattern = ConformanceClasses.CORE.pattern
assert core_pattern.match("https://api.stacspec.org/v1.0.0/core")