sage icon indicating copy to clipboard operation
sage copied to clipboard

Fix test failure in doctest of rank method

Open user202729 opened this issue 8 months ago • 3 comments

Failure seen in https://github.com/sagemath/sage/pull/39725/files#annotation_33948370801 . It can be computed that the probability of failure is ≈ 1/16007, which is tiny but still can happen if there is a sufficiently large number of pull requests the code being ran on.

:memo: Checklist

  • [x] The title is concise and informative.
  • [x] The description explains in detail what this PR is about.
  • [x] I have linked a relevant issue or discussion.
  • [ ] I have created tests covering the changes.
  • [x] I have updated the documentation and checked the documentation preview.

:hourglass: Dependencies

user202729 avatar Apr 19 '25 13:04 user202729

Documentation preview for this PR (built with commit 711835d994137c0b4e51ae5d0a176538333af63f; changes) is ready! :tada: This preview will update shortly after each push to this PR.

github-actions[bot] avatar Apr 19 '25 21:04 github-actions[bot]

Your fix looks good to me.

While we're at it, do you know the rationale for _ = A.rank() on line 2115 ? I'd guess it's to see that storing the rank of A does not affect the test A == B? But it seems to be exactly what the doctest you fixed is already doing. Maybe we could add a test that _ == B.rank() is true, in which case r might be a more appropriate name.

r-mb avatar Apr 29 '25 17:04 r-mb

my reasonable guess is it triggers computing the rank which updates the cache in a certain way. And/or it checks that computing the rank does not raise an error or anything.

user202729 avatar Apr 29 '25 21:04 user202729

So I'm still getting notifications about this PR, but it seems to me it has already been merged to develop?

r-mb avatar Jun 02 '25 12:06 r-mb

Huh?

Looks like @vbraun 's script malfunctioned and didn't close this pull request. Either that, or GitHub is supposed to close pull requests automatically and it malfunction on this one somehow.

Anyway the commit which is supposed to be included in cc9cb8df41a, and it is included now.

user202729 avatar Jun 02 '25 14:06 user202729