Fix test failure in doctest of rank method
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
Documentation preview for this PR (built with commit 711835d994137c0b4e51ae5d0a176538333af63f; changes) is ready! :tada: This preview will update shortly after each push to this PR.
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.
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.
So I'm still getting notifications about this PR, but it seems to me it has already been merged to develop?
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.