mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 18:15:28 +03:00
start make tests
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
from typing import Callable
|
||||
from inspect import getfullargspec
|
||||
import re
|
||||
|
||||
from ..command.entity import Command
|
||||
from ..router.entity import Router
|
||||
from ..command.exceptions import (UnprocessedInputFlagException,
|
||||
IncorrectNumberOfHandlerArgsException,
|
||||
RepeatedInputFlagsException,
|
||||
EmptyInputCommandException)
|
||||
from .exceptions import (InvalidRouterInstanceException,
|
||||
InvalidDescriptionMessagePatternException,
|
||||
NoRegisteredRoutersException,
|
||||
NoRegisteredHandlersException,
|
||||
RepeatedCommandInDifferentRoutersException)
|
||||
RepeatedCommandInDifferentRoutersException,
|
||||
IncorrectNumberOfHandlerArgsException)
|
||||
|
||||
|
||||
class App:
|
||||
@@ -129,9 +130,11 @@ class App:
|
||||
|
||||
|
||||
def set_description_message_pattern(self, pattern: str) -> None:
|
||||
try:
|
||||
pattern.format(command='command', description='description')
|
||||
except KeyError:
|
||||
first_check = re.match(r'.*{commmand}.*', pattern)
|
||||
second_check = re.match(r'.*{description}.*', pattern)
|
||||
print(first_check)
|
||||
print(second_check)
|
||||
if bool(first_check) and bool(second_check):
|
||||
raise InvalidDescriptionMessagePatternException(pattern)
|
||||
else:
|
||||
self._description_message_pattern: str = pattern
|
||||
|
||||
@@ -28,3 +28,8 @@ class NoRegisteredHandlersException(Exception):
|
||||
class RepeatedCommandInDifferentRoutersException(Exception):
|
||||
def __str__(self):
|
||||
return "Commands in different handlers cannot be repeated"
|
||||
|
||||
|
||||
class IncorrectNumberOfHandlerArgsException(Exception):
|
||||
def __str__(self):
|
||||
return "Incorrect Input Flags Handler has incorrect number of arguments"
|
||||
|
||||
Reference in New Issue
Block a user