code: def test_swinnerton_dyer_poly():
      raises(ValueError, lambda: swinnerton_dyer_poly(0, x))
  
      assert swinnerton_dyer_poly(1, x, polys=True) == Poly(x**2 - 2)
  
      assert swinnerton_dyer_poly(1, x) == x**2 - 2
      assert swinnerton_dyer_poly(2, x) == x**4 - 10 * x**2 + 1
      assert (
          swinnerton_dyer_poly(3, x)
          == x**8 - 40 * x**6 + 352 * x**4 - 960 * x**2 + 576
      )
      # we only need to check that the polys arg works but
      # we may as well test that the roots are correct
      p = [sqrt(prime(i)) for i in range(1, 5)]
      assert str(
          [
              i.n(3)
              for i in swinnerton_dyer_poly(4, polys=True).all_roots()
          ]
      ) == str(sorted([Add(*i).n(3) for i in permute_signs(p)]))
  
file_path: sympy/sympy/polys/tests/test_specialpolys.py
imports: from sympy.core.add import Add
  from sympy.core.symbol import symbols
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.ntheory.generate import prime
  from sympy.polys.domains.integerring import ZZ
  from sympy.polys.polytools import Poly
  from sympy.utilities.iterables import permute_signs
  from sympy.testing.pytest import raises
  from sympy.polys.specialpolys import swinnerton_dyer_poly, cyclotomic_poly, symmetric_poly, random_poly, interpolating_poly, fateman_poly_F_1, dmp_fateman_poly_F_1, fateman_poly_F_2, dmp_fateman_poly_F_2, fateman_poly_F_3, dmp_fateman_poly_F_3
  from sympy.abc import x, y, z
label_desc: Use image node_id 1 for calling a global function with example usage: test_swinnerton_dyer_poly() without return types