Skip to content

Commit beadc16

Browse files
committed
More coverage
1 parent f26d2fd commit beadc16

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/sage/arith/misc.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3574,6 +3574,21 @@ def CRT_list(values, moduli=None):
35743574
sage: CRT_list([mpz(2),mpz(3),mpz(2)], [mpz(3),mpz(5),mpz(7)])
35753575
23
35763576
3577+
Tests for call with one argument::
3578+
3579+
sage: x = CRT_list([mod(2,3)]); x
3580+
2
3581+
sage: x.parent()
3582+
Ring of integers modulo 3
3583+
sage: x = CRT_list([]); x
3584+
0
3585+
sage: x.parent()
3586+
Ring of integers modulo 1
3587+
sage: x = CRT_list([2]); x
3588+
Traceback (most recent call last):
3589+
...
3590+
TypeError: if one argument is given, it should be a list of IntegerMod
3591+
35773592
Make sure we are not mutating the input lists::
35783593
35793594
sage: xs = [1,2,3]
@@ -3593,7 +3608,7 @@ def CRT_list(values, moduli=None):
35933608
if not values:
35943609
return Mod(0, 1)
35953610
if not all(isinstance(v, IntegerMod_abstract) for v in values):
3596-
raise TypeError("arguments to CRT_list should be lists of IntegerMod")
3611+
raise TypeError("if one argument is given, it should be a list of IntegerMod")
35973612
if len(values) == 1:
35983613
return values[0]
35993614
moduli = [v.modulus() for v in values]

0 commit comments

Comments
 (0)