Skip to content

Commit

Permalink
fix: str(ENUM) should just stringify the slug (#999)
Browse files Browse the repository at this point in the history
  • Loading branch information
tushar-composio authored Dec 12, 2024
1 parent e595d81 commit 259db26
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions python/composio/client/enums/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def __hash__(self) -> int:
def __repr__(self) -> str:
return f"{self.__class__.__name__}.{self.slug}"

def __str__(self) -> str:
return self.slug

def __eq__(self, other: object) -> bool:
if isinstance(other, Enum):
return self.slug == other.slug
Expand Down
1 change: 1 addition & 0 deletions python/tests/test_client/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def test_tag_enum() -> None:
def test_app_enum() -> None:
"""Test `App` enum."""
assert App.GITHUB == "GITHUB"
assert str(App.GITHUB) == "GITHUB"
assert not App.GITHUB.is_local
assert App("OUTLOOK") == App.OUTLOOK
assert App("gmail") == App.GMAIL
Expand Down
2 changes: 1 addition & 1 deletion python/tests/test_tools/test_toolset.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_invalid_account_id(self) -> None:
with pytest.raises(
ComposioSDKError,
match=re.escape(
f"Invalid connected accounts found: [('App.GITHUB', '{self.connected_account}')]"
f"Invalid connected accounts found: [('GITHUB', '{self.connected_account}')]"
),
):
ComposioToolSet(
Expand Down

0 comments on commit 259db26

Please sign in to comment.