code: def test_invalid_expr_exceptions():
      """Regression test for GitHub Issue #486: check that an exception is
      raised for invalid expressions.
  
      """
      p1 = lmfit.Parameters()
      p1.add("t", 2.0, min=0.0, max=5.0)
      p1.add("x", 10.0)
  
      with pytest.raises(SyntaxError):
          p1.add("y", expr="x*t + sqrt(t)/")
      assert len(p1["y"]._expr_eval.error) > 0
  
      p1.add("y", expr="x*t + sqrt(t)/3.0")
      p1["y"].set(expr="x*3.0 + t**2")
      assert "x*3" in p1["y"].expr
      assert len(p1["y"]._expr_eval.error) == 0
  
      with pytest.raises(SyntaxError):
          p1["y"].set(expr="t+")
      assert len(p1["y"]._expr_eval.error) > 0
      assert_allclose(p1["y"].value, 34.0)
  
imports: from copy import copy, deepcopy
  import os
  import pickle
  import numpy
  from numpy.testing import assert_allclose
  import pytest
  import lmfit
  from lmfit.models import VoigtModel
label_desc: Use image node_id 31 for calling a global function with example usage: test_invalid_expr_exceptions() without return types