chia-blockchain/tests/util/test_pprint.py
Adam Kelly db19671827
Check Wallet DB integrity (#14401)
* Check Wallet DB integrity

* Update command line help

* Improve duplicate DerivationPath index error message

* Move tests to chia/tests

* lint

* py init file

* Print WalletType names

* Don't complain about wallets not having derivation entries that don't need them

* Validate addresses used in order

* Update tests with new error output

* Fix check_addresses_used_contiguous in the case when the last address of the previous wallet was unused
2023-02-21 18:35:15 -06:00

18 lines
653 B
Python

from __future__ import annotations
from chia.util.pprint import print_compact_ranges
def test_print_compact_ranges() -> None:
assert print_compact_ranges([]) == "[]"
assert print_compact_ranges([1]) == "[1]"
assert print_compact_ranges([1, 2]) == "[1 to 2]"
assert print_compact_ranges([2, 1]) == "[1 to 2]"
assert print_compact_ranges([1, 3, 4]) == "[1, 3 to 4]"
assert print_compact_ranges([1, 2, 4]) == "[1 to 2, 4]"
assert print_compact_ranges([1, 2, 4, 5]) == "[1 to 2, 4 to 5]"
assert print_compact_ranges([-1, -2]) == "[-2 to -1]"
assert print_compact_ranges([1, 1, 1, 2, 2, 4, 4, 9]) == "[1 to 2, 4, 9]"