'Caching must not mix up different error models.'

def test_error_model(self):

    def inv(x):
        return (1.0 / x)
    inv_sig = typing.signature(types.float64, types.float64)
    def compile_inv(context):
        return context.compile_subroutine(builder, inv, inv_sig)
    (context, builder, sig, args) = self._context_builder_sig_args()
    py_error_model = callconv.create_error_model('python', context)
    np_error_model = callconv.create_error_model('numpy', context)
    py_context1 = context.subtarget(error_model=py_error_model)
    py_context2 = context.subtarget(error_model=py_error_model)
    np_context = context.subtarget(error_model=np_error_model)
    self.assertEqual(0, len(context.cached_internal_func))
    compile_inv(py_context1)
    self.assertEqual(1, len(context.cached_internal_func))
    compile_inv(py_context2)
    self.assertEqual(1, len(context.cached_internal_func))
    compile_inv(np_context)
    self.assertEqual(2, len(context.cached_internal_func))
