To answer my own question, I just found: If # optional or # needs is placed right after the sage: prompt, it is a block-scoped tag, which applies to all doctest lines until a blank line is encountered.
On Monday 19 August 2024 at 1:51:29 pm UTC+10 Andrew wrote: > I am adding some doc-tests to some code that is currently configured as a > package. My tests look like: > > EXAMPLES:: > > sage: X(...) # needs my_package > sage: Y(...) # needs my_package > sage: Z(...) # needs my_package > > Is there a way to avoid adding # needs my_package to every line? Ideally, > it should be possible to set this once at the beginning of the file, but it > would be an improvement if it was only needed once per test-block. > > I thought that there was a recent post about this issue, but I couldn't > find it. Sorry if I have missed it. > > Andrew > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/ad6f3c91-d4c9-4b47-94c9-4e716e9237fcn%40googlegroups.com.