24 lines
1.1 KiB
Python
24 lines
1.1 KiB
Python
import csv
|
|
|
|
p = '/root/troupe-standup/wizard-work/ledger/crypto_top10.csv'
|
|
rows = list(csv.DictReader(open(p)))
|
|
|
|
expected_names = ['Bitcoin', 'Ethereum', 'Tether', 'BNB', 'XRP', 'USDC',
|
|
'Solana', 'TRON', 'Figure Heloc', 'Zcash']
|
|
expected_ranks = list(range(1, 11))
|
|
|
|
assert len(rows) == 10, f'row count = {len(rows)}'
|
|
assert [r['name'] for r in rows] == expected_names, 'names/order'
|
|
assert [int(r['rank']) for r in rows] == expected_ranks, 'ranks'
|
|
assert all(float(r['current_price']) > 0 for r in rows), 'non-positive price'
|
|
assert all(float(r['market_cap']) > 0 for r in rows), 'non-positive market cap'
|
|
caps = [float(r['market_cap']) for r in rows]
|
|
assert caps == sorted(caps, reverse=True), 'market cap not descending'
|
|
print('CHECK_OK 10 rows, ranks 1-10, names/order/values verified')
|
|
|
|
# Cross-check against the raw API snapshot: names present and rank position consistent.
|
|
raw = __import__('json').load(open('/root/troupe-standup/wizard-work/ledger/raw_crypto.json'))
|
|
raw_names = [r['name'] for r in raw[:10]]
|
|
assert raw_names == expected_names, 'raw snapshot rank mismatch'
|
|
print('CHECK_OK snapshot matches live fetch')
|