Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 5bac984

Browse files
committed
19171: Add tests
1 parent bcc4534 commit 5bac984

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

src/sage/rings/polynomial/polynomial_element.pyx

+22-4
Original file line numberDiff line numberDiff line change
@@ -9696,6 +9696,15 @@ cdef class Polynomial(CommutativeAlgebraElement):
96969696
False
96979697
sage: R(0).divides(R(0))
96989698
True
9699+
sage: S.<y> = R[]
9700+
sage: p = x * y**2 + (2*x + 1) * y + x + 1
9701+
sage: q = (x + 1) * y + (3*x + 2)
9702+
sage: q.divides(p)
9703+
False
9704+
sage: q.divides(p * q)
9705+
True
9706+
9707+
TESTS::
96999708
sage: R.<x> = PolynomialRing(ZZ, implementation="NTL")
97009709
sage: (2*x + 1).divides(4*x**2 + 1)
97019710
False
@@ -9704,10 +9713,19 @@ cdef class Polynomial(CommutativeAlgebraElement):
97049713
sage: S.<y> = R[]
97059714
sage: p = ((3*z + 2)*x + 2*z - 1) * y + 2*x + z
97069715
sage: q = y^2 + z*y*x + 2*y + z
9707-
sage: p.divides(q)
9708-
False
9709-
sage: p.divides(p*q)
9710-
True
9716+
sage: p.divides(q), p.divides(p*q)
9717+
(False, True)
9718+
sage: R.<x,y> = GF(2)[]
9719+
sage: S.<z> = R[]
9720+
sage: p = (x+y+1) * z + x*y
9721+
sage: q = (y^2-x^2) * z^2 + z + x-y
9722+
sage: p.divides(q), p.divides(p*q)
9723+
(False, True)
9724+
sage: R.<x> = Zmod(6)[]
9725+
sage: p = 4*x + 3
9726+
sage: q = 5*x**2 + x + 2
9727+
sage: p.divides(q), p.divides(p*q)
9728+
(False, True)
97119729
"""
97129730
if p.is_zero(): return True # everything divides 0
97139731
if self.is_zero(): return False # 0 only divides 0

0 commit comments

Comments
 (0)