mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Fix failing tests to use new get_parameter function
This commit is contained in:
parent
1727eca106
commit
57efb5a5a0
@ -491,7 +491,7 @@ class Parameter:
|
|||||||
The maximum supported value for this parameter.
|
The maximum supported value for this parameter.
|
||||||
default: Any
|
default: Any
|
||||||
The default value of the parameter, if given.
|
The default value of the parameter, if given.
|
||||||
If not given then this is :data:`discord.utils.MISSING`.
|
If not given then this is :data:`~discord.utils.MISSING`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, parent: CommandParameter) -> None:
|
def __init__(self, parent: CommandParameter) -> None:
|
||||||
|
@ -1396,7 +1396,8 @@ Utility Functions
|
|||||||
|
|
||||||
.. autofunction:: discord.utils.as_chunks
|
.. autofunction:: discord.utils.as_chunks
|
||||||
|
|
||||||
.. data:: discord.utils.MISSING
|
.. data:: MISSING
|
||||||
|
:module: discord.utils
|
||||||
|
|
||||||
A type safe sentinel used in the library to represent something as missing. Used to distinguish from ``None`` values.
|
A type safe sentinel used in the library to represent something as missing. Used to distinguish from ``None`` values.
|
||||||
|
|
||||||
|
@ -508,19 +508,19 @@ Defaults
|
|||||||
|
|
||||||
.. data:: discord.ext.commands.Author
|
.. data:: discord.ext.commands.Author
|
||||||
|
|
||||||
A default :class:`.Parameter` which returns the :attr:`~.Context.author` for this context.
|
A default :class:`Parameter` which returns the :attr:`~.Context.author` for this context.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
.. data:: discord.ext.commands.CurrentChannel
|
.. data:: discord.ext.commands.CurrentChannel
|
||||||
|
|
||||||
A default :class:`.Parameter` which returns the :attr:`~.Context.channel` for this context.
|
A default :class:`Parameter` which returns the :attr:`~.Context.channel` for this context.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
.. data:: discord.ext.commands.CurrentGuild
|
.. data:: discord.ext.commands.CurrentGuild
|
||||||
|
|
||||||
A default :class:`.Parameter` which returns the :attr:`~.Context.guild` for this context. This will never be ``None``. If the command is called in a DM context then :exc:`~discord.ext.commands.NoPrivateMessage` is raised to the error handlers.
|
A default :class:`Parameter` which returns the :attr:`~.Context.guild` for this context. This will never be ``None``. If the command is called in a DM context then :exc:`~discord.ext.commands.NoPrivateMessage` is raised to the error handlers.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ def test_descriptions_describe():
|
|||||||
...
|
...
|
||||||
|
|
||||||
assert describe.description == 'This is the short description that will appear.'
|
assert describe.description == 'This is the short description that will appear.'
|
||||||
assert describe._params['arg'].description == 'Decorator description of arg.'
|
assert describe.get_parameter('arg').description == 'Decorator description of arg.' # type: ignore
|
||||||
assert describe._params['arg2'].description == 'Decorator description of arg2.'
|
assert describe.get_parameter('arg2').description == 'Decorator description of arg2.' # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def test_descriptions_no_args():
|
def test_descriptions_no_args():
|
||||||
@ -66,8 +66,8 @@ def test_descriptions_numpy():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
assert numpy.description == 'This is the short description that will appear.'
|
assert numpy.description == 'This is the short description that will appear.'
|
||||||
assert numpy._params['arg'].description == 'Docstring description of arg. This is the second line of the arg docstring.'
|
assert numpy.get_parameter('arg').description == 'Docstring description of arg. This is the second line of the arg docstring.' # type: ignore
|
||||||
assert numpy._params['arg2'].description == 'Docstring description of arg2.'
|
assert numpy.get_parameter('arg2').description == 'Docstring description of arg2.' # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def test_descriptions_numpy_extras():
|
def test_descriptions_numpy_extras():
|
||||||
@ -94,8 +94,8 @@ def test_descriptions_numpy_extras():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
assert numpy.description == 'This is the short description that will appear.'
|
assert numpy.description == 'This is the short description that will appear.'
|
||||||
assert numpy._params['arg'].description == 'Docstring description of arg. This is the second line of the arg docstring.'
|
assert numpy.get_parameter('arg').description == 'Docstring description of arg. This is the second line of the arg docstring.' # type: ignore
|
||||||
assert numpy._params['arg2'].description == 'Docstring description of arg2.'
|
assert numpy.get_parameter('arg2').description == 'Docstring description of arg2.' # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def test_descriptions_google():
|
def test_descriptions_google():
|
||||||
@ -112,8 +112,8 @@ def test_descriptions_google():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
assert google.description == 'This is the short description that will appear.'
|
assert google.description == 'This is the short description that will appear.'
|
||||||
assert google._params['arg'].description == 'Docstring description of arg. This is the second line of the arg docstring.'
|
assert google.get_parameter('arg').description == 'Docstring description of arg. This is the second line of the arg docstring.' # type: ignore
|
||||||
assert google._params['arg2'].description == 'Docstring description of arg2.'
|
assert google.get_parameter('arg2').description == 'Docstring description of arg2.' # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def test_descriptions_google_extras():
|
def test_descriptions_google_extras():
|
||||||
@ -136,8 +136,8 @@ def test_descriptions_google_extras():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
assert google.description == 'This is the short description that will appear.'
|
assert google.description == 'This is the short description that will appear.'
|
||||||
assert google._params['arg'].description == 'Docstring description of arg. This is the second line of the arg docstring.'
|
assert google.get_parameter('arg').description == 'Docstring description of arg. This is the second line of the arg docstring.' # type: ignore
|
||||||
assert google._params['arg2'].description == 'Docstring description of arg2.'
|
assert google.get_parameter('arg2').description == 'Docstring description of arg2.' # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def test_descriptions_sphinx():
|
def test_descriptions_sphinx():
|
||||||
@ -155,8 +155,8 @@ def test_descriptions_sphinx():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
assert sphinx.description == 'This is the short description that will appear.'
|
assert sphinx.description == 'This is the short description that will appear.'
|
||||||
assert sphinx._params['arg'].description == 'Docstring description of arg. This is the second line of the arg docstring.'
|
assert sphinx.get_parameter('arg').description == 'Docstring description of arg. This is the second line of the arg docstring.' # type: ignore
|
||||||
assert sphinx._params['arg2'].description == 'Docstring description of arg2.'
|
assert sphinx.get_parameter('arg2').description == 'Docstring description of arg2.' # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def test_descriptions_sphinx_extras():
|
def test_descriptions_sphinx_extras():
|
||||||
@ -178,8 +178,8 @@ def test_descriptions_sphinx_extras():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
assert sphinx.description == 'This is the short description that will appear.'
|
assert sphinx.description == 'This is the short description that will appear.'
|
||||||
assert sphinx._params['arg'].description == 'Docstring description of arg. This is the second line of the arg docstring.'
|
assert sphinx.get_parameter('arg').description == 'Docstring description of arg. This is the second line of the arg docstring.' # type: ignore
|
||||||
assert sphinx._params['arg2'].description == 'Docstring description of arg2.'
|
assert sphinx.get_parameter('arg2').description == 'Docstring description of arg2.' # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def test_descriptions_docstring_and_describe():
|
def test_descriptions_docstring_and_describe():
|
||||||
@ -197,8 +197,8 @@ def test_descriptions_docstring_and_describe():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
assert describe.description == 'This is the short description that will appear.'
|
assert describe.description == 'This is the short description that will appear.'
|
||||||
assert describe._params['arg'].description == 'Decorator description of arg.'
|
assert describe.get_parameter('arg').description == 'Decorator description of arg.' # type: ignore
|
||||||
assert describe._params['arg2'].description == 'Docstring description of arg2.'
|
assert describe.get_parameter('arg2').description == 'Docstring description of arg2.' # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def test_descriptions_group_no_args():
|
def test_descriptions_group_no_args():
|
||||||
@ -228,8 +228,8 @@ def test_descriptions_group_args():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
assert my_command.description == 'Test slash command'
|
assert my_command.description == 'Test slash command'
|
||||||
assert my_command._params['arg'].description == 'Description of arg. This is the second line of the arg description.'
|
assert my_command.get_parameter('arg').description == 'Description of arg. This is the second line of the arg description.' # type: ignore
|
||||||
assert my_command._params['arg2'].description == 'Description of arg2.'
|
assert my_command.get_parameter('arg2').description == 'Description of arg2.' # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def test_descriptions_cog_commands():
|
def test_descriptions_cog_commands():
|
||||||
@ -249,5 +249,5 @@ def test_descriptions_cog_commands():
|
|||||||
|
|
||||||
cog = MyCog()
|
cog = MyCog()
|
||||||
assert cog.test.description == 'Test slash command'
|
assert cog.test.description == 'Test slash command'
|
||||||
assert cog.test._params['arg'].description == 'Description of arg. This is the second line of the arg description.'
|
assert cog.test.get_parameter('arg').description == 'Description of arg. This is the second line of the arg description.' # type: ignore
|
||||||
assert cog.test._params['arg2'].description == 'Description of arg2.'
|
assert cog.test.get_parameter('arg2').description == 'Description of arg2.' # type: ignore
|
||||||
|
Loading…
x
Reference in New Issue
Block a user