mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
ce7e24b924
The entire public api is covered with documentation in two languages - Russian and English. the library now supports the latest three versions of python - 3.12, 3.13 and 3.14 minor design changes: now, when a Boolean flag is entered, its value is an empty string, not None. tests have been adapted to the supported versions of python, readmi has been redesigned in two languages, German is no longer available.
75 lines
2.4 KiB
Python
75 lines
2.4 KiB
Python
import unittest
|
|
|
|
from argenta.app import App
|
|
from argenta.command.models import Command, InputCommand
|
|
from argenta.router import Router
|
|
|
|
|
|
class MyTestCase(unittest.TestCase):
|
|
def test_is_exit_command1(self):
|
|
app = App()
|
|
self.assertEqual(app._is_exit_command(InputCommand('q')), True)
|
|
|
|
def test_is_exit_command5(self):
|
|
app = App()
|
|
self.assertEqual(app._is_exit_command(InputCommand('Q')), True)
|
|
|
|
def test_is_exit_command2(self):
|
|
app = App(ignore_command_register=False)
|
|
self.assertEqual(app._is_exit_command(InputCommand('q')), False)
|
|
|
|
def test_is_exit_command3(self):
|
|
app = App(exit_command=Command('quit'))
|
|
self.assertEqual(app._is_exit_command(InputCommand('quit')), True)
|
|
|
|
def test_is_exit_command4(self):
|
|
app = App(exit_command=Command('quit'))
|
|
self.assertEqual(app._is_exit_command(InputCommand('qUIt')), True)
|
|
|
|
def test_is_exit_command6(self):
|
|
app = App(ignore_command_register=False,
|
|
exit_command=Command('quit'))
|
|
self.assertEqual(app._is_exit_command(InputCommand('qUIt')), False)
|
|
|
|
def test_is_unknown_command1(self):
|
|
app = App()
|
|
app.set_unknown_command_handler(lambda command: None)
|
|
app._current_matching_triggers_with_routers = {'fr': Router(), 'tr': Router(), 'de': Router()}
|
|
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._current_matching_triggers_with_routers = {'fr': Router(), 'tr': Router(), 'de': Router()}
|
|
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._current_matching_triggers_with_routers = {'Pr': Router(), 'tW': Router(), 'deQW': Router()}
|
|
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._current_matching_triggers_with_routers = {'Pr': Router(), 'tW': Router(), 'deQW': Router()}
|
|
self.assertEqual(app._is_unknown_command(InputCommand('tW')), False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|