From b5ddfb3b35efdfb530bab61d938e468a2b17368f Mon Sep 17 00:00:00 2001 From: kolo Date: Sun, 27 Apr 2025 13:28:11 +0300 Subject: [PATCH] new tests --- pyproject.toml | 2 +- tests/unit_tests/test_app.py | 21 ++++++++++++++++++++- tests/unit_tests/test_router.py | 12 ++++++------ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index eca33d9..32046fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "argenta" -version = "1.0.0-alpha1" +version = "1.0.0-alpha2" description = "Python library for creating TUI" authors = [{ name = "kolo", email = "kolo.is.main@gmail.com" }] requires-python = ">=3.11, <4.0" diff --git a/tests/unit_tests/test_app.py b/tests/unit_tests/test_app.py index 1b7b607..914fc8c 100644 --- a/tests/unit_tests/test_app.py +++ b/tests/unit_tests/test_app.py @@ -1,5 +1,5 @@ from argenta.command.models import InputCommand, Command -from src.argenta.app import App +from argenta.app import App import unittest @@ -32,9 +32,28 @@ class MyTestCase(unittest.TestCase): def test_is_unknown_command1(self): app = App() + app.set_unknown_command_handler(lambda command: None) app._all_registered_triggers_in_lower = ['fr', 'tr', 'de'] self.assertEqual(app._is_unknown_command(InputCommand('fr')), False) + def test_is_unknown_command2(self): + app = App() + app.set_unknown_command_handler(lambda command: None) + app._all_registered_triggers_in_lower = ['fr', 'tr', 'de'] + self.assertEqual(app._is_unknown_command(InputCommand('cr')), True) + + def test_is_unknown_command3(self): + app = App(ignore_command_register=False) + app.set_unknown_command_handler(lambda command: None) + app._all_registered_triggers_in_default_case = ['Pr', 'tW', 'deQW'] + self.assertEqual(app._is_unknown_command(InputCommand('pr')), True) + + def test_is_unknown_command4(self): + app = App(ignore_command_register=False) + app.set_unknown_command_handler(lambda command: None) + app._all_registered_triggers_in_default_case = ['Pr', 'tW', 'deQW'] + self.assertEqual(app._is_unknown_command(InputCommand('tW')), False) + diff --git a/tests/unit_tests/test_router.py b/tests/unit_tests/test_router.py index e1a22aa..6ccb3a7 100644 --- a/tests/unit_tests/test_router.py +++ b/tests/unit_tests/test_router.py @@ -1,10 +1,10 @@ from argenta.command.flag import InputFlags, InputFlag, Flag, Flags -from src.argenta.router import Router -from src.argenta.command import Command -from src.argenta.router.exceptions import (TriggerContainSpacesException, - RepeatedFlagNameException, - TooManyTransferredArgsException, - RequiredArgumentNotPassedException) +from argenta.router import Router +from argenta.command import Command +from argenta.router.exceptions import (TriggerContainSpacesException, + RepeatedFlagNameException, + TooManyTransferredArgsException, + RequiredArgumentNotPassedException) import unittest import re