On 1/10/20 2:16 PM, Vincent Delecroix wrote:
>
> - Any alternative suggestion?
This comes up a lot. The ideal answer is: use a preprocessor directive
to compile out the unsupported tests. But naturally that doesn't work so
well in an interpreted language.
One workaround is to maintain separate branches of your code, for
example a 1.x branch that supports sage < 9.0, and a 2.x branch that
supports sage >= 9.0. So long as the number of distinct version ranges
you support is small, this isn't *too* annoying.
> - Any vote pro or against such a tag? I think that if we go
> for it, everybody should agree so that it becomes a standard
> and gets specified in the SageMath documentation.
>
> Of course such a tag would be useless for the Sage library itself.
>
All the other solutions I'm aware of involve runtime testing of some
kind. Even if you detect the sage version at "build time," you wind up
with a runtime variable test like
if sage_version >= 9.0:
some_function.__doc__ += "a test for sage-9.x"
And that's more or less what the "# optional" tag gives you anyway.
Since the doctests are supposed to serve foremost as documentation, my
first impression is that a dedicated tag would be appropriate here. It's
consistent with what we already do, and it helps the reader understand
what's going on without making the source code horrendous.