File: test.py

package info (click to toggle)
errbot 6.2.0%2Bds-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,848 kB
  • sloc: python: 11,573; makefile: 162; sh: 97
file content (24 lines) | stat: -rw-r--r-- 654 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from __future__ import absolute_import

from errbot import BotPlugin, arg_botcmd, botcmd, re_botcmd


class Test(BotPlugin):
    """Just a test plugin to see if _err_botcmd_syntax is consistent on all types of botcmd"""

    @botcmd  # no syntax
    def foo_nosyntax(self, msg, args):
        pass

    @botcmd(syntax="[optional] <mandatory>")
    def foo(self, msg, args):
        pass

    @re_botcmd(pattern=r".*")
    def re_foo(self, msg, match):
        pass

    @arg_botcmd("value", type=str)
    @arg_botcmd("--repeat-count", dest="repeat", type=int, default=2)
    def arg_foo(self, msg, value=None, repeat=None):
        return value * repeat