start make tests

This commit is contained in:
2025-03-03 00:10:07 +03:00
parent 5e6cdc342e
commit d9c74310c3
33 changed files with 100 additions and 69 deletions
+8 -5
View File
@@ -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
+5
View File
@@ -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"