示例#1
0
 def _find_stats(self):
     stats = self._character['Stats']
     if '$id' in stats:
         return stats
     ref = stats['$ref']
     return search_recursively(self._party_data, ref, id_matches)
示例#2
0
def test_in_dict_match():
    data = {'blah': expected_node}
    result = search_recursively(data, expected_key, example_algorithm)
    assert result == expected_node
示例#3
0
def test_deeply_nested_match():
    data = {'blah': ['blarg', None, {'foo': ['jar', {'blob': expected_node}]}]}
    result = search_recursively(data, expected_key, example_algorithm)
    assert result == expected_node
示例#4
0
def test_in_array_match():
    data = ['blarg', {'foo': 'bar'}, expected_node]
    result = search_recursively(data, expected_key, example_algorithm)
    assert result == expected_node
示例#5
0
def test_no_match():
    data = {'blah': ['blarg', {'foo': 'bar'}]}
    result = search_recursively(data, expected_key, example_algorithm)
    assert result == None
示例#6
0
def test_top_node_match():
    result = search_recursively(expected_node, expected_key, example_algorithm)
    assert result == expected_node
 def _find_character(self):
     return search_recursively(self._party_data, self._key, _key_matches)
示例#8
0
def _search_for_player(entity):
    if 'Stats' in entity['Descriptor']:
        return entity['Descriptor']
    ref = entity['Descriptor']['$ref']
    return search_recursively(entity, ref, id_matches)