Esempio n. 1
0
def test_clean_callable_example_nickname(tmpconfig, func):
    module.commands('test')(func)
    module.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'
Esempio n. 2
0
def test_clean_callable_example_nickname(tmpconfig, func):
    module.commands('test')(func)
    module.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'
Esempio n. 3
0
def test_clean_callable_example_user_help(tmpconfig, func):
    module.commands('test')(func)
    module.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']
Esempio n. 4
0
def test_clean_callable_example_user_help(tmpconfig, func):
    module.commands('test')(func)
    module.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']
Esempio n. 5
0
def test_clean_callable_example_default_prefix(tmpconfig, func):
    module.commands('test')(func)
    module.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'
Esempio n. 6
0
def test_clean_callable_example_first_only(tmpconfig, func):
    module.commands('test')(func)
    module.example('.test hello')(func)
    module.example('.test bonjour')(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'
Esempio n. 7
0
def test_clean_callable_example_default_prefix(tmpconfig, func):
    module.commands('test')(func)
    module.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'
Esempio n. 8
0
def test_clean_callable_example_first_only(tmpconfig, func):
    module.commands('test')(func)
    module.example('.test hello')(func)
    module.example('.test bonjour')(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'
Esempio n. 9
0
def test_clean_callable_example_multi_commands(tmpconfig, func):
    module.commands('test')(func)
    module.commands('unit')(func)
    module.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'
Esempio n. 10
0
def test_clean_callable_example_multi_commands(tmpconfig, func):
    module.commands('test')(func)
    module.commands('unit')(func)
    module.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'