Skip to content

Add type annotations for nodes, node handles and assets

Add type annotations for TestTools' types:

  • for external use (for testers):
    • AnyAsset (Asset.Hive, Asset.Hbd, Asset.Vest and their testnet alternatives)
    • AnyLocalNodeHandle as AnyLocalNode (ApiNode, InitNode, WitnessNode or RawNode)
    • AnyNodeHandle as AnyNode (all above and also RemoteNode)
  • for internal use (inside TestTools):
    • AnyLocalNode
    • AnyNode

So now it can be used with syntax:

from __future__ import annotations  # Required in Python older than 3.10 (currently we use 3.8)

import test_tools as tt


def transfer(node: tt.AnyLocalNode, amount: tt.AnyAsset):
    ...

Reviewers:

Merge request reports

Loading