MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / get_sub_array_from_array

Function get_sub_array_from_array

qa/rpc-tests/receivedby.py:12–26  ·  view source on GitHub ↗

Finds and returns a sub array from an array of arrays. to_match should be a unique idetifier of a sub array

(object_array, to_match)

Source from the content-addressed store, hash-verified

10
11
12def get_sub_array_from_array(object_array, to_match):
13 '''
14 Finds and returns a sub array from an array of arrays.
15 to_match should be a unique idetifier of a sub array
16 '''
17 num_matched = 0
18 for item in object_array:
19 all_match = True
20 for key,value in to_match.items():
21 if item[key] != value:
22 all_match = False
23 if not all_match:
24 continue
25 return item
26 return []
27
28def check_array_result(object_array, to_match, expected, should_not_find = False):
29 """

Callers 1

run_testMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected