Ask Your Question
1

Doctest doesn't find new function

asked 2023-06-28 17:59:25 +0200

deinst gravatar image

I thought that I would fix gihub bug #22313 (Implement Euler Polynomials)

So I added a function (boiled down, the implementation here is obviously incorrect)

def euler_polynomial(x, n):
    r"""
    Compute the value of the ``n``-th Euler polynomial at ``x``.

    TESTS::

        sage: y=QQ['y'].gen()
        sage: euler_polynomial(y, 0)
        1
    """
    return 1

Now if I run ./sage -t src/sage/combinat/combinat.py I get

[...]
      File "<doctest sage.combinat.combinat.euler_polynomial[1]>", line 1, in <module>
        euler_polynomial(y, Integer(0))
        ^^^^^^^^^^^^^^^^
    NameError: name 'euler_polynomial' is not defined
**********************************************************************
1 item had failures:
   1 of   3 in sage.combinat.combinat.euler_polynomial
    [462 tests, 1 failure, 2.38 s]

I am obviously doing something wrong, but am at a loss as to what. I have tried rebuilding sage.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-06-28 18:16:59 +0200

updated 2023-06-28 18:17:33 +0200

Functions are not automatically imported, so you need to add a line to the doctest:

TESTS::

    sage: from sage.combinat.combinat import euler_polynomial
    sage: y = QQ['y'].gen()
    ...
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2023-06-28 17:59:25 +0200

Seen: 65 times

Last updated: Jun 28 '23