code: def test_to_number_field():
      assert to_number_field(sqrt(2)) == AlgebraicNumber(sqrt(2))
      assert to_number_field([sqrt(2), sqrt(3)]) == AlgebraicNumber(
          sqrt(2) + sqrt(3)
      )
  
      a = AlgebraicNumber(
          sqrt(2) + sqrt(3), [S.Half, S.Zero, Rational(-9, 2), S.Zero]
      )
  
      assert to_number_field(sqrt(2), sqrt(2) + sqrt(3)) == a
      assert (
          to_number_field(sqrt(2), AlgebraicNumber(sqrt(2) + sqrt(3)))
          == a
      )
  
      raises(
          IsomorphismFailed, lambda: to_number_field(sqrt(2), sqrt(3))
      )
  
file_path: sympy/sympy/polys/numberfields/tests/test_subfield.py
imports: from sympy.core.numbers import AlgebraicNumber, I, pi, Rational
  from sympy.core.singleton import S
  from sympy.functions.elementary.exponential import exp
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.external.gmpy import MPQ
  from sympy.polys.numberfields.subfield import is_isomorphism_possible, field_isomorphism_pslq, field_isomorphism, primitive_element, to_number_field
  from sympy.polys.polyerrors import IsomorphismFailed
  from sympy.polys.polytools import Poly
  from sympy.polys.rootoftools import CRootOf
  from sympy.testing.pytest import raises
  from sympy.abc import x
label_desc: Use image node_id 4 for calling a global function with example usage: test_to_number_field() without return types