def setup_save_failure(set_many):
 field_data = MagicMock(spec=FieldData)
 field_data.get = (lambda block, name, default=None: 99)
 field_data.set_many = set_many
 class FieldTester(XBlock, ):
  '\n        Test XBlock with three fields\n        '
  field_a = Integer(scope=Scope.settings)
  field_b = Integer(scope=Scope.content, default=10)
  field_c = Integer(scope=Scope.user_state, default=42)
 field_tester = FieldTester(TestRuntime(services={'field-data': field_data}), scope_ids=Mock(spec=ScopeIds))
 return field_tester

def setup_save_failure ( set_many ) : field_data = MagicMock ( spec = FieldData ) field_data . get = ( lambda block , name , default = None : 99 ) field_data . set_many = set_many class FieldTester ( XBlock , ) : field_a = Integer ( scope = Scope . settings ) field_b = Integer ( scope = Scope . content , default = 10 ) field_c = Integer ( scope = Scope . user_state , default = 42 ) field_tester = FieldTester ( TestRuntime ( services = { 'field-data' : field_data } ) , scope_ids = Mock ( spec = ScopeIds ) ) return field_tester
set up tests for when theres a save error in the underlying keyvaluestore .