def test_clean_callable_example_nickname(tmpconfig, func): plugin.commands('test')(func) plugin.example('$nickname: hello')(func) loader.clean_callable(func, tmpconfig) assert len(func._docs) == 1 assert 'test' in func._docs docs = func._docs['test'] assert len(docs) == 2 assert docs[0] == inspect.cleandoc(func.__doc__).splitlines() assert docs[1] == ['TestBot: hello']
def test_clean_callable_example_user_help(tmpconfig, func): plugin.commands('test')(func) plugin.example('.test hello', user_help=True)(func) loader.clean_callable(func, tmpconfig) assert len(func._docs) == 1 assert 'test' in func._docs docs = func._docs['test'] assert len(docs) == 2 assert docs[0] == inspect.cleandoc(func.__doc__).splitlines() assert docs[1] == ['.test hello']
def test_clean_callable_example_not_set(tmpconfig, func): plugin.commands('test')(func) loader.clean_callable(func, tmpconfig) assert hasattr(func, '_docs') assert len(func._docs) == 1 assert 'test' in func._docs docs = func._docs['test'] assert len(docs) == 2 assert docs[0] == inspect.cleandoc(func.__doc__).splitlines() assert docs[1] == []
def test_clean_callable_example_default_prefix(tmpconfig, func): plugin.commands('test')(func) plugin.example('.test hello')(func) tmpconfig.core.help_prefix = '!' loader.clean_callable(func, tmpconfig) assert len(func._docs) == 1 assert 'test' in func._docs docs = func._docs['test'] assert len(docs) == 2 assert docs[0] == inspect.cleandoc(func.__doc__).splitlines() assert docs[1] == ['!test hello']
def test_clean_callable_example_multi_commands(tmpconfig, func): plugin.commands('test')(func) plugin.commands('unit')(func) plugin.example('.test hello')(func) loader.clean_callable(func, tmpconfig) assert hasattr(func, '_docs') assert len(func._docs) == 2 assert 'test' in func._docs assert 'unit' in func._docs test_docs = func._docs['test'] unit_docs = func._docs['unit'] assert len(test_docs) == 2 assert test_docs == unit_docs assert test_docs[0] == inspect.cleandoc(func.__doc__).splitlines() assert test_docs[1] == ['.test hello']