sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.34k stars 460 forks source link

Insufficient testing coverage for asymptotics_multiple() #24053

Open jdemeyer opened 6 years ago

jdemeyer commented 6 years ago

In the file src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py, the function asymptotics_multiple() is insufficiently doctested. It seems that only the case "n == d" is tested. All tests in sage/rings/asymptotic still pass when applying

--- a/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py
+++ b/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py
@@ -2204,6 +2204,7 @@ class FractionWithFactoredDenominator(RingElement):
             return (exp_scale ** asy_var * subexp_part, exp_scale, subexp_part)

         # Case n < d.
+        assert(False)
         # If P is a tuple of rationals, then compute with it directly.
         # Otherwise, compute symbolically and plug in P at the end.
         if vector(P.values()) not in QQ ** d:

I discovered this because the function binomial is imported from a deprecated module, but no deprecation warning triggers.

Possibly related: #19989

CC: @dkrenn @sagetrac-araichev

Component: asymptotic expansions

Issue created by migration from https://trac.sagemath.org/ticket/24053

jdemeyer commented 6 years ago

Description changed:

--- 
+++ 
@@ -13,3 +13,5 @@
                            for q in range(N)])

is not tested at all. To see this, you can remove the import of the function binomial and all tests still pass. + +I discovered this because the function binomial is imported from a deprecated module, but no deprecation warning triggers.

jdemeyer commented 6 years ago

Description changed:

--- 
+++ 
@@ -1,17 +1,5 @@
-In the file `src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py`, the function `asymptotics_multiple()` is insufficiently doctested. In particular, the code block
-
-```python
-        chunk = det * sum([(alpha[d - 1] * asy_var) ** ((n - d) /
-                                                        Integer(2) - q) *
-                           sum([L[(j, k)] * binomial(n - 1, j) *
-                                stirling_number1(n - j, n + k - q) *
-                                (-1) ** (q - j - k)
-                                for (j, k) in product(range(min(n - 1, q) + 1),
-                                                      range(max(0, q - n),
-                                                             q + 1))
-                                if j + k <= q])
-                           for q in range(N)])
-```
-is not tested at all. To see this, you can remove the import of the function `binomial` and all tests still pass.
+In the file `src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py`, the function `asymptotics_multiple()` is insufficiently doctested. It seems that only the case "`n == d`" is tested.

 I discovered this because the function `binomial` is imported from a deprecated module, but no deprecation warning triggers.
+
+Possibly related: #19989
jdemeyer commented 6 years ago

Description changed:

--- 
+++ 
@@ -1,4 +1,17 @@
-In the file `src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py`, the function `asymptotics_multiple()` is insufficiently doctested. It seems that only the case "`n == d`" is tested.
+In the file `src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py`, the function `asymptotics_multiple()` is insufficiently doctested. It seems that only the case "`n == d`" is tested. All tests in `sage/rings/asymptotic` still pass when applying
+
+```diff
+--- a/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py
++++ b/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py
+@@ -2204,6 +2204,7 @@ class FractionWithFactoredDenominator(RingElement):
+             return (exp_scale ** asy_var * subexp_part, exp_scale, subexp_part)
+ 
+         # Case n < d.
++        assert(False)
+         # If P is a tuple of rationals, then compute with it directly.
+         # Otherwise, compute symbolically and plug in P at the end.
+         if vector(P.values()) not in QQ ** d:
+```

 I discovered this because the function `binomial` is imported from a deprecated module, but no deprecation warning triggers.