code: def test_as_int():
      raises(ValueError, lambda: as_int(True))
      raises(ValueError, lambda: as_int(1.1))
      raises(ValueError, lambda: as_int([]))
      raises(ValueError, lambda: as_int(S.NaN))
      raises(ValueError, lambda: as_int(S.Infinity))
      raises(ValueError, lambda: as_int(S.NegativeInfinity))
      raises(ValueError, lambda: as_int(S.ComplexInfinity))
      # for the following, limited precision makes int(arg) == arg
      # but the int value is not necessarily what a user might have
      # expected; Q.prime is more nuanced in its response for
      # expressions which might be complex representations of an
      # integer. This is not -- by design -- as_ints role.
      raises(ValueError, lambda: as_int(1e23))
      raises(ValueError, lambda: as_int(S("1." + "0" * 20 + "1")))
      assert as_int(True, strict=False) == 1
  
file_path: sympy/sympy/utilities/tests/test_misc.py
imports: from textwrap import dedent
  import sys
  from subprocess import Popen, PIPE
  import os
  from sympy.core.singleton import S
  from sympy.testing.pytest import raises, warns_deprecated_sympy, skip_under_pyodide
  from sympy.utilities.misc import translate, replace, ordinal, rawlines, strlines, as_int, find_executable
  from sympy.external import import_module
label_desc: Use image node_id 8 for calling a global function with example usage: test_as_int() without return types