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)
| 10 | |
| 11 | |
| 12 | def 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 | |
| 28 | def check_array_result(object_array, to_match, expected, should_not_find = False): |
| 29 | """ |