First time here? Check out the FAQ!

Ask Your Question
2

Dynamic documentation, how to use EXAMPLE:: tag?

asked 1 year ago

Dear all, I'm writing the documentation of a package. A function described answers the time taken by the computation (and other things). Problem: this time varies ... `

 EXAMPLE::
 sage: give_me_the_time_taken_to_process(input_data)
 0.03s

Since Sagemath runs doctest, it tests this example and issues a warning every time the time taken is different -- Do you have a good solution for me? Many thanks in advance! Olivier

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 1 year ago

slelievre gravatar image

updated 1 year ago

One option is to add a "random" tag.

Then, when testing, the value of the output will be ignored.

Running the test will only test whether an exception is raised.

EXAMPLES::

    sage: give_me_the_time_taken_to_process(input_data)  # random
    0.03s

See the developer manual, chapter "Coding basics", section "Special markup to influence doctests":

Preview: (hide)
link

Comments

Great, thanks! Olivier

Olivier R. gravatar imageOlivier R. ( 1 year ago )

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: 1 year ago

Seen: 161 times

Last updated: Apr 02 '24