Red-DiscordBot/tests/core/test_commands.py
Toby Harradine 48a7a21aca
[Commands] Refactor command and group decorators (#1818)
* [V3 Commands] Refactor command and group decorators

* Add some tests

* Fix docs reference

* Tweak Group's MRO
2018-08-26 23:25:25 +10:00

35 lines
843 B
Python

import pytest
from redbot.core import commands
@pytest.fixture(scope="session")
def group():
@commands.group()
async def fixturegroup(*args, **kwargs):
return args, kwargs
return fixturegroup
def is_Command(obj):
return isinstance(obj, commands.Command)
def is_Group(obj):
return isinstance(obj, commands.Group)
def test_command_decorators(coroutine):
assert is_Command(commands.command(name="cmd")(coroutine))
assert is_Group(commands.group(name="grp")(coroutine))
def test_group_decorator_methods(group, coroutine):
assert is_Command(group.command(name="cmd")(coroutine))
assert is_Group(group.group(name="grp")(coroutine))
def test_bot_decorator_methods(red, coroutine):
assert is_Command(red.command(name="cmd")(coroutine))
assert is_Group(red.group(name="grp")(coroutine))