def test_nested_cache(self): self.flock['dest'] = reference(self.flock, 'source') self.flock['nested_dest'] = {'dest': reference(self.flock, 'nested_source', 'source')} self.flock['jump_dest'] = {'dest': reference(self.flock['nested_source'], 'source')} assert self.flock['dest'] == self.flock['nested_dest']['dest'] == 'Original Value' self.flock['source'] = '1st New Value' assert self.flock['dest'] == '1st New Value' assert self.flock['nested_dest']['dest'] == self.flock['jump_dest']['dest'] == 'Original Value' self.flock['nested_source']['source'] = '2nd New Value' assert self.flock['dest'] == '1st New Value' assert self.flock['nested_dest']['dest'] == '2nd New Value' assert self.flock['jump_dest']['dest'] == '2nd New Value'
def apply_attribs(character): for attribute in character['base_stats']: character[attribute] = reference(character, 'base_stats', attribute)
def test_reference(self): probe = uuid.uuid4() base_dict={'x':probe} assert probe is reference(base_dict,'x')()
def test_reference(self): probe = uuid.uuid4() self.base_dict['x'] = probe assert probe is reference(self.base_dict, 'x')()