Esempio n. 1
0
 def test_dict_set_does_not_raise(self):
     example = {'hello': 'world'}
     ac = bindings.DictAccessor(example, 'i do not exist')
     bindings.BREAK_ON_ACCESS_FAILURE = True
     ac.push(True)
     assert example['i do not exist']
Esempio n. 2
0
 def test_dict_returns_zero_for_no_key(self):
     example = {'hello': 'world'}
     ac = bindings.DictAccessor(example, 'i do not exist')
     bindings.BREAK_ON_ACCESS_FAILURE = False
     assert ac.pull() == 0
Esempio n. 3
0
 def test_dict_set(self):
     example = {'hello': 'world'}
     ac = bindings.DictAccessor(example, 'hello')
     ac.push('Las Vegas')
     assert example['hello'] == 'Las Vegas'
Esempio n. 4
0
 def test_dict_raises(self):
     example = {'hello': 'world'}
     ac = bindings.DictAccessor(example, 'i do not exist')
     bindings.BREAK_ON_ACCESS_FAILURE = True
     self.assertRaises(Exception, ac.pull)
Esempio n. 5
0
 def test_dict_get(self):
     example = {'hello': 'world'}
     ac = bindings.DictAccessor(example, 'hello')
     assert ac.pull() == 'world'