refactor tests and add new

This commit is contained in:
2025-12-06 11:55:50 +03:00
parent a2ef2652ed
commit 1d2ab6f6bb
17 changed files with 294 additions and 31 deletions
+2 -5
View File
@@ -39,9 +39,6 @@ class BaseFlags(Generic[FlagType]):
def __iter__(self) -> Iterator[FlagType]:
return iter(self.flags)
def __next__(self) -> FlagType:
return next(iter(self))
def __getitem__(self, flag_index: int) -> FlagType:
return self.flags[flag_index]
@@ -61,7 +58,7 @@ class Flags(BaseFlags[Flag]):
@override
def __eq__(self, other: object) -> bool:
if not isinstance(other, Flags):
return NotImplemented
return False
if len(self.flags) != len(other.flags):
return False
@@ -91,7 +88,7 @@ class InputFlags(BaseFlags[InputFlag]):
@override
def __eq__(self, other: object) -> bool:
if not isinstance(other, InputFlags):
raise NotImplementedError
return False
if len(self.flags) != len(other.flags):
return False
+3 -6
View File
@@ -53,10 +53,7 @@ class Flag:
if isinstance(self.possible_values, Pattern):
return bool(self.possible_values.match(input_flag_value))
if isinstance(self.possible_values, list):
return input_flag_value in self.possible_values
return False
return input_flag_value in self.possible_values
@property
def string_entity(self) -> str:
@@ -88,9 +85,9 @@ class InputFlag:
self,
name: str,
*,
prefix: PREFIX_TYPE = "--",
input_value: str,
status: ValidationStatus | None,
prefix: PREFIX_TYPE = "--",
status: ValidationStatus | None = None,
):
"""
Public. The entity of the flag of the entered command
-3
View File
@@ -104,9 +104,6 @@ class InputCommand:
else:
raise UnprocessedInputFlagException
if not name:
raise UnprocessedInputFlagException
if i + 1 < len(tokens) and not tokens[i + 1].startswith("-"):
input_value = tokens[i + 1]
i += 2