# Path: phial/globals.py
# def _find_command() -> Message:
# 
# Path: phial/wrappers.py
# class Message:
#     """
#     A representation of a Slack message.
# 
#     :param text: The message contents
#     :param channel: The Slack channel ID the message was sent from
#     :param user: The user who sent the message
#     :param timestamp: The message's timestamp
#     :param team: The Team ID of the Slack workspace the message was
#                  sent from
#     :param bot_id: If the message was sent by a bot
#                    the ID of that bot. Defaults to None.
#     """
# 
#     def __init__(
#         self,
#         text: str,
#         channel: str,
#         user: str,
#         timestamp: str,
#         team: Optional[str],
#         bot_id: Optional[str] = None,
#     ) -> None:
#         self.text = text
#         self.channel = channel
#         self.user = user
#         self.timestamp = timestamp
#         self.team = team
#         self.bot_id = bot_id
# 
#     def __repr__(self) -> str:
#         return "<Message: {0} in {1}:{2} at {3}>".format(
#             self.text, self.channel, self.team, self.timestamp
#         )
# 
#     def __eq__(self, other: object) -> bool:
#         return self.__dict__ == other.__dict__


import pytest
from phial.globals import _command_ctx_stack, _find_command
from phial.wrappers import Message
"""Test globals."""



def test_find_command_throws_when_no_command() -> None:
    """Test find_command errors correctly."""
    with pytest.raises(Exception) as e:
        _find_command()
    assert e is not None


def test_find_command_returns_command() -> None:
    """Test find_command returns correctly."""
    _command_ctx_stack.push(Message("text", "channel", "user", "ts", "team"))

# Path: phial/globals.py
# def _find_command() -> Message:
# 
# Path: phial/wrappers.py
# class Message:
#     """
#     A representation of a Slack message.
# 
#     :param text: The message contents
#     :param channel: The Slack channel ID the message was sent from
#     :param user: The user who sent the message
#     :param timestamp: The message's timestamp
#     :param team: The Team ID of the Slack workspace the message was
#                  sent from
#     :param bot_id: If the message was sent by a bot
#                    the ID of that bot. Defaults to None.
#     """
# 
#     def __init__(
#         self,
#         text: str,
#         channel: str,
#         user: str,
#         timestamp: str,
#         team: Optional[str],
#         bot_id: Optional[str] = None,
#     ) -> None:
#         self.text = text
#         self.channel = channel
#         self.user = user
#         self.timestamp = timestamp
#         self.team = team
#         self.bot_id = bot_id
# 
#     def __repr__(self) -> str:
#         return "<Message: {0} in {1}:{2} at {3}>".format(
#             self.text, self.channel, self.team, self.timestamp
#         )
# 
#     def __eq__(self, other: object) -> bool:
#         return self.__dict__ == other.__dict__


# Path: tests/test_globals.py
import pytest
from phial.globals import _command_ctx_stack, _find_command
from phial.wrappers import Message

"""Test globals."""



def test_find_command_throws_when_no_command() -> None:
    """Test find_command errors correctly."""
    with pytest.raises(Exception) as e:
        _find_command()
    assert e is not None


def test_find_command_returns_command() -> None:
    """Test find_command returns correctly."""
    _command_ctx_stack.push(Message("text", "channel", "user", "ts", "team"))

    result = _find_command()