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
2 changes: 1 addition & 1 deletion pystac/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class StringEnum(str, Enum):
value."""

def __repr__(self) -> str:
return str(self.value)
return repr(self.value)

def __str__(self) -> str:
return cast(str, self.value)
Expand Down
8 changes: 8 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pystac import utils
from pystac.utils import (
JoinType,
StringEnum,
is_absolute_href,
is_file_path,
join_path_or_url,
Expand Down Expand Up @@ -474,3 +475,10 @@ def test_join_path_or_url() -> None:
)
def test_is_file_path(href: str, expected: bool) -> None:
assert is_file_path(href) == expected


def test_stringenum_repr() -> None:
class SomeEnum(StringEnum):
THIS = "this"

assert repr(SomeEnum.THIS) == "'this'"