@@ -438,11 +438,17 @@ def test_fmpz_poly():
438438 assert Z ([1 ,2 ,2 ]).sqrt () is None
439439 assert Z ([1 ,0 ,2 ,0 ,3 ]).deflation () == (Z ([1 ,2 ,3 ]), 2 )
440440 assert Z ([1 ,1 ]).deflation () == (Z ([1 ,1 ]), 1 )
441- [(r ,m )] = Z ([1 ,1 ]).roots ()
441+ [(r ,m )] = Z ([1 ,1 ]).complex_roots ()
442442 assert m == 1
443443 assert r .overlaps (- 1 )
444+ assert Z ([]).complex_roots () == []
445+ assert Z ([1 ]).complex_roots () == []
446+ [(r ,m )] = Z ([1 ,1 ]).roots ()
447+ assert m == 1
448+ assert r == - 1
444449 assert Z ([]).roots () == []
445450 assert Z ([1 ]).roots () == []
451+ assert Z ([1 , 2 ]).roots () == []
446452
447453def test_fmpz_poly_factor ():
448454 Z = flint .fmpz_poly
@@ -985,11 +991,13 @@ def set_bad():
985991 assert Q .bernoulli_poly (3 ) == Q ([0 ,1 ,- 3 ,2 ],2 )
986992 assert Q .euler_poly (3 ) == Q ([1 ,0 ,- 6 ,4 ],4 )
987993 assert Q .legendre_p (3 ) == Q ([0 ,- 3 ,0 ,5 ],2 )
988- assert Q ([]).roots () == []
989- assert Q ([1 ]).roots () == []
990- [(r ,m )] = Q ([1 ,1 ]).roots ()
994+ assert Q ([]).complex_roots () == []
995+ assert Q ([1 ]).complex_roots () == []
996+ [(r ,m )] = Q ([1 ,1 ]).complex_roots ()
991997 assert m == 1
992998 assert r .overlaps (- 1 )
999+ assert str (Q ([1 ,2 ]).roots ()) == "[(-1/2, 1)]"
1000+ assert Q ([2 ,1 ]).roots () == [(- 2 , 1 )]
9931001
9941002def test_fmpq_mat ():
9951003 Q = flint .fmpq_mat
@@ -1411,6 +1419,9 @@ def set_bad2():
14111419 for alg in [None , 'berlekamp' , 'cantor-zassenhaus' ]:
14121420 assert p3 .factor (alg ) == f3
14131421 assert p3 .factor (algorithm = alg ) == f3
1422+ assert P ([1 ], 11 ).roots () == []
1423+ assert P ([1 , 2 , 3 ], 11 ).roots () == [(8 , 1 ), (6 , 1 )]
1424+ assert P ([1 , 6 , 1 , 8 ], 11 ).roots () == [(5 , 3 )]
14141425
14151426def test_nmod_mat ():
14161427 M = flint .nmod_mat
0 commit comments