Skip to content

Commit

Permalink
test: sopel.loader.clean_callable function with intents
Browse files Browse the repository at this point in the history
  • Loading branch information
Exirel committed Jan 23, 2019
1 parent f78eada commit 0856072
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,22 @@ def test_clean_callable_example_nickname(tmpconfig, func):
assert docs[1] == 'Sopel: hello'


def test_clean_callable_intents(tmpconfig, func):
setattr(func, 'intents', [r'abc'])
loader.clean_callable(func, tmpconfig)

assert hasattr(func, 'intents')
assert len(func.intents) == 1

# Test the regex is compiled properly
regex = func.intents[0]
assert regex.match('abc')
assert regex.match('abcd')
assert regex.match('ABC')
assert regex.match('AbCdE')
assert not regex.match('efg')


def test_load_module_pymod(tmpdir):
root = tmpdir.mkdir('loader_mods')
mod_file = root.join('file_mod.py')
Expand Down

0 comments on commit 0856072

Please sign in to comment.