Skip to content

Fix inherently failing random_expr doctest #24425

Closed
@rwst

Description

@rwst

The docs for random_expr read:

  This function will often raise an error because it tries to create
  an erroneous expression (such as a division by zero).

It has the following doctest:

        sage: from sage.symbolic.random_tests import *
        sage: set_random_seed(53)
        sage: random_expr(50, nvars=3, coeff_generator=CDF.random_element) # random
        (v1^(0.97134084277 + 0.195868299334*I)/csc(-pi + v1^2 + v3) + sgn(1/
...

Despite having a random seed the test run changes with every new builtin function introduced in sage/functions because the global function list changes. That's why the test was marked random. The problem however is that the test can even raise an error, as the docs state above. The"random" keyword does not catch this, and it would make the test useless anyway.

Tests are meant to test the functionality of the associated code so the test and perhaps random_expr should be rewritten such that it allows a test that does not change with a changed global function list.

Component: symbolics

Author: Ralf Stephan

Branch: a17755c

Reviewer: Marc Mezzarobba

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions