code: def test_dmp_ext_factor():
      R, x, y = ring("x,y", QQ.algebraic_field(sqrt(2)))
  
      def anp(x):
          return ANP(x, [QQ(1), QQ(0), QQ(-2)], QQ)
  
      assert R.dmp_ext_factor(0) == (anp([]), [])
  
      f = anp([QQ(1)]) * x + anp([QQ(1)])
  
      assert R.dmp_ext_factor(f) == (anp([QQ(1)]), [(f, 1)])
  
      g = anp([QQ(2)]) * x + anp([QQ(2)])
  
      assert R.dmp_ext_factor(g) == (anp([QQ(2)]), [(f, 1)])
  
      f = anp([QQ(1)]) * x**2 + anp([QQ(-2)]) * y**2
  
      assert R.dmp_ext_factor(f) == (
          anp([QQ(1)]),
          [
              (anp([QQ(1)]) * x + anp([QQ(-1), QQ(0)]) * y, 1),
              (anp([QQ(1)]) * x + anp([QQ(1), QQ(0)]) * y, 1),
          ],
      )
  
      f = anp([QQ(2)]) * x**2 + anp([QQ(-4)]) * y**2
  
      assert R.dmp_ext_factor(f) == (
          anp([QQ(2)]),
          [
              (anp([QQ(1)]) * x + anp([QQ(-1), QQ(0)]) * y, 1),
              (anp([QQ(1)]) * x + anp([QQ(1), QQ(0)]) * y, 1),
          ],
      )
  
imports: from sympy.polys.rings import ring, xring
  from sympy.polys.domains import FF, ZZ, QQ, ZZ_I, QQ_I, RR, EX
  from sympy.polys import polyconfig
  from sympy.polys.polyerrors import DomainError
  from sympy.polys.polyclasses import ANP
  from sympy.polys.specialpolys import f_polys, w_polys
  from sympy.core.numbers import I
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.functions.elementary.trigonometric import sin
  from sympy.ntheory.generate import nextprime
  from sympy.testing.pytest import raises, XFAIL
label_desc: Use image node_id 21 for calling a global function with example usage: test_dmp_ext_factor() and returns: ANP