code: def test_fromstring(self):
      x = as_symbol("x")
      y = as_symbol("y")
      z = as_symbol("z")
      f = as_symbol("f")
      s = as_string('"ABC"')
      t = as_string('"123"')
      a = as_array((x, y))
  
      assert fromstring("x") == x
      assert fromstring("+ x") == x
      assert fromstring("-  x") == -x
      assert fromstring("x + y") == x + y
      assert fromstring("x + 1") == x + 1
      assert fromstring("x * y") == x * y
      assert fromstring("x * 2") == x * 2
      assert fromstring("x / y") == x / y
      assert fromstring("x ** 2", language=Language.Python) == x**2
      assert (
          fromstring("x ** 2 ** 3", language=Language.Python)
          == x**2**3
      )
      assert fromstring("(x + y) * z") == (x + y) * z
  
      assert fromstring("f(x)") == f(x)
      assert fromstring("f(x,y)") == f(x, y)
      assert fromstring("f[x]") == f[x]
      assert fromstring("f[x][y]") == f[x][y]
  
      assert fromstring('"ABC"') == s
      assert (
          normalize(
              fromstring('"ABC" // "123" ', language=Language.Fortran)
          )
          == s // t
      )
      assert fromstring('f("ABC")') == f(s)
      assert fromstring('MYSTRKIND_"ABC"') == as_string(
          '"ABC"', "MYSTRKIND"
      )
  
      assert fromstring("(/x, y/)") == a, fromstring("(/x, y/)")
      assert fromstring("f((/x, y/))") == f(a)
      assert fromstring("(/(x+y)*z/)") == as_array(((x + y) * z,))
  
      assert fromstring("123") == as_number(123)
      assert fromstring("123_2") == as_number(123, 2)
      assert fromstring("123_myintkind") == as_number(123, "myintkind")
  
      assert fromstring("123.0") == as_number(123.0, 4)
      assert fromstring("123.0_4") == as_number(123.0, 4)
      assert fromstring("123.0_8") == as_number(123.0, 8)
      assert fromstring("123.0e0") == as_number(123.0, 4)
      assert fromstring("123.0d0") == as_number(123.0, 8)
      assert fromstring("123d0") == as_number(123.0, 8)
      assert fromstring("123e-0") == as_number(123.0, 4)
      assert fromstring("123d+0") == as_number(123.0, 8)
      assert fromstring("123.0_myrealkind") == as_number(
          123.0, "myrealkind"
      )
      assert fromstring("3E4") == as_number(30000.0, 4)
  
      assert fromstring("(1, 2)") == as_complex(1, 2)
      assert fromstring("(1e2, PI)") == as_complex(
          as_number(100.0), as_symbol("PI")
      )
  
      assert fromstring("[1, 2]") == as_array(
          (as_number(1), as_number(2))
      )
  
      assert fromstring("POINT(x, y=1)") == as_apply(
          as_symbol("POINT"), x, y=as_number(1)
      )
      assert fromstring(
          'PERSON(name="John", age=50, shape=(/34, 23/))'
      ) == as_apply(
          as_symbol("PERSON"),
          name=as_string('"John"'),
          age=as_number(50),
          shape=as_array((as_number(34), as_number(23))),
      )
  
      assert fromstring("x?y:z") == as_ternary(x, y, z)
  
      assert fromstring("*x") == as_deref(x)
      assert fromstring("**x") == as_deref(as_deref(x))
      assert fromstring("&x") == as_ref(x)
      assert fromstring("(*x) * (*y)") == as_deref(x) * as_deref(y)
      assert fromstring("(*x) * *y") == as_deref(x) * as_deref(y)
      assert fromstring("*x * *y") == as_deref(x) * as_deref(y)
      assert fromstring("*x**y") == as_deref(x) * as_deref(y)
  
      assert fromstring("x == y") == as_eq(x, y)
      assert fromstring("x != y") == as_ne(x, y)
      assert fromstring("x < y") == as_lt(x, y)
      assert fromstring("x > y") == as_gt(x, y)
      assert fromstring("x <= y") == as_le(x, y)
      assert fromstring("x >= y") == as_ge(x, y)
  
      assert fromstring("x .eq. y", language=Language.Fortran) == as_eq(
          x, y
      )
      assert fromstring("x .ne. y", language=Language.Fortran) == as_ne(
          x, y
      )
      assert fromstring("x .lt. y", language=Language.Fortran) == as_lt(
          x, y
      )
      assert fromstring("x .gt. y", language=Language.Fortran) == as_gt(
          x, y
      )
      assert fromstring("x .le. y", language=Language.Fortran) == as_le(
          x, y
      )
      assert fromstring("x .ge. y", language=Language.Fortran) == as_ge(
          x, y
      )
  
file_path: catboost/contrib/python/numpy/py3/numpy/f2py/tests/test_symbolic.py
imports: import pytest
  from numpy.f2py.symbolic import Expr, Op, ArithOp, Language, as_symbol, as_number, as_string, as_array, as_complex, as_terms, as_factors, eliminate_quotes, insert_quotes, fromstring, as_expr, as_apply, as_numer_denom, as_ternary, as_ref, as_deref, normalize, as_eq, as_ne, as_lt, as_gt, as_le, as_ge
  from .None import util
label_desc: Use image node_id 7 for calling the TestSymbolic obj's underlying member method code with example usage: obj.test_fromstring() without return types