예제 #1
0
 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'
예제 #2
0
 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'
예제 #3
0
파일: model.py 프로젝트: matrixise/flock
def apply_attribs(character):
    for attribute in character['base_stats']:
        character[attribute] = reference(character, 'base_stats', attribute)
예제 #4
0
파일: model.py 프로젝트: Ciemaar/flock
def apply_attribs(character):
    for attribute in character['base_stats']:
        character[attribute] = reference(character, 'base_stats', attribute)
예제 #5
0
 def test_reference(self):
     probe = uuid.uuid4()
     base_dict={'x':probe}
     assert probe is reference(base_dict,'x')()
예제 #6
0
 def test_reference(self):
     probe = uuid.uuid4()
     self.base_dict['x'] = probe
     assert probe is reference(self.base_dict, 'x')()