diff --git a/pystac/utils.py b/pystac/utils.py index 6c0690c78..76c3f7100 100644 --- a/pystac/utils.py +++ b/pystac/utils.py @@ -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) diff --git a/tests/test_utils.py b/tests/test_utils.py index 44dd6998a..76ea0d50a 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -10,6 +10,7 @@ from pystac import utils from pystac.utils import ( JoinType, + StringEnum, is_absolute_href, is_file_path, join_path_or_url, @@ -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'"