Skip to content

Commit bd83e0d

Browse files
authored
Merge branch 'main' into lebovits/590-increase-test-coverage
2 parents 1c01b9c + 54b96f0 commit bd83e0d

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1515

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

18+
### Added
19+
20+
- Add comprehensive test coverage for ConformanceClasses enum ([#834](https://github.com/stac-utils/pystac-client/pull/834))
21+
1822
### Documentation
1923

2024
- Update contributing guide to consistently use `uv` workflow ([#822](https://github.com/stac-utils/pystac-client/pull/822))
2125
- Fix format script to use `ruff-format` instead of deprecated `black` hook ([#822](https://github.com/stac-utils/pystac-client/pull/822))
2226
- 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))
2327

28+
2429
## [v0.9.0] - 2025-07-17
2530

2631
### Added

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ dev = [
5252
"pytest~=8.0",
5353
"recommonmark~=0.7.1",
5454
"requests-mock~=1.12",
55-
"ruff==0.13.3",
55+
"ruff==0.14.0",
5656
"tomli~=2.0; python_version<'3.11'",
5757
"types-python-dateutil>=2.8.19,<2.10.0",
5858
"types-requests~=2.32.0",

tests/test_conformance.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import pytest
2+
3+
from pystac_client.conformance import ConformanceClasses
4+
5+
6+
class TestConformanceClasses:
7+
def test_get_by_name_raises_for_invalid_names(self) -> None:
8+
"""Test get_by_name raises ValueError for invalid conformance class names."""
9+
with pytest.raises(ValueError, match="Invalid conformance class 'invalid'"):
10+
ConformanceClasses.get_by_name("invalid")
11+
12+
with pytest.raises(ValueError, match="Invalid conformance class 'nonexistent'"):
13+
ConformanceClasses.get_by_name("nonexistent")
14+
15+
with pytest.raises(ValueError, match="Invalid conformance class ''"):
16+
ConformanceClasses.get_by_name("")
17+
18+
def test_get_by_name_valid(self) -> None:
19+
"""Test get_by_name with valid conformance class names."""
20+
assert ConformanceClasses.get_by_name("core") == ConformanceClasses.CORE
21+
assert ConformanceClasses.get_by_name("CORE") == ConformanceClasses.CORE
22+
23+
def test_valid_uri_property(self) -> None:
24+
"""Test valid_uri property returns correct URI pattern."""
25+
assert (
26+
ConformanceClasses.CORE.valid_uri == "https://api.stacspec.org/v1.0.*/core"
27+
)
28+
29+
def test_pattern_property(self) -> None:
30+
"""Test pattern property returns compiled regex."""
31+
core_pattern = ConformanceClasses.CORE.pattern
32+
assert core_pattern.match("https://api.stacspec.org/v1.0.0/core")

0 commit comments

Comments
 (0)