Improve testing cli framework with features from python 3.12
There are helper methods of TestingCli like process_savings_deposit or process_savings_withdrawal that are silimar to cli commands "clive process savings deposit", "clive process savings withdrawal" etc). We accept multiple named arguments. This is however not easily extansible (if there are more commands there will be more boilerplate code). In python however 3.12 there is implemented https://peps.python.org/pep-0692/ . This allows adding types to **kwargs argument, as in example:
class Movie(TypedDict):
title: str
year: NotRequired[int]
def foo(name, /, **kwargs: Unpack[Movie]) -> None: ...
we could define following types for kwargs:
class OperationCommon(TypedDict):
profile_name: NotRequired[str]
password: NotRequired[str]
sign: NotRequired[str]
beekeeper_remote: NotRequired[str]
broadcast: NotRequired[bool]
save_file: NotRequired[str]
class TransferCommon(TypedDict):
amount: Required[tt.Asset.AntT]
memo: NotRequired[bool]
from_account: NotRequired[str]
class Transfer(OperationCommon, TransferCommon):
to: Required[str]
and define method transfer inside class TestingCli:
def transfer(name, /, **kwargs: Unpack[Transfer]) -> Result: ...
Benefit is much shorter code, we can also reuse common options as in CliveTyper (where it is done by decorators, we could also use decorators here but this feature from python 3.12 is much simpler) and it will be easy to add more cli commands.
I'm not sure when we will use python 3.12, this will happen when we use ubuntu 24.04 for hive image (python 3.12 is default on ubuntu 24.04)