MCPcopy Create free account
hub / github.com/ElementsProject/lightning / check_sql

Function check_sql

tests/test_coinmoves.py:16–26  ·  view source on GitHub ↗
(node, kind, expected)

Source from the content-addressed store, hash-verified

14
15# While we're doing this, check sql plugin's representation too.
16def check_sql(node, kind, expected):
17 columns = only_one(node.rpc.listsqlschemas(kind)['schemas'])['columns']
18 ret = node.rpc.sql(f"SELECT * FROM {kind}")
19 assert len(ret['rows']) == len(expected)
20 for row, e in zip(ret['rows'], expected):
21 assert len(row) == len(columns)
22 for val, col in zip(row, columns):
23 if col['name'] in e:
24 assert val == e[col['name']], f"{col['name']} is {val} not {e[col['name']]}: ({row} vs {columns})"
25 elif col['name'] not in ('rowid', 'timestamp'):
26 assert val is None, f"{col['name']} is not None ({row} vs {columns})"
27
28
29def check_moves(moves, expected):

Callers 2

check_channel_movesFunction · 0.85
check_chain_movesFunction · 0.85

Calls 1

only_oneFunction · 0.90

Tested by

no test coverage detected