-
-
Notifications
You must be signed in to change notification settings - Fork 647
Fix fricas doctest pickling #40570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix fricas doctest pickling #40570
Conversation
Replace problematic doctest 'fricas == loads(dumps(fricas))' with 'isinstance(loads(dumps(a)), FriCAS)' where a is a fresh FriCAS instance. The original test was failing because the global 'fricas' object contains module-level lazy imports that cannot be pickled. Using a fresh instance and checking type instead of equality avoids the LazyImport pickling issue while still validating serialization round-trip functionality. Fixes doctest failures in sage.interfaces.fricas.FriCAS.__init__ and sage.interfaces.fricas.FriCAS._quit_string methods.
Fix ruff linting error W293 by removing trailing whitespace from blank line in doctest.
Remove malformed literal block structure in TESTS section that was causing RST218 error. Properly format the doctest examples.
Remove TESTS:: header that was causing RST218 literal block formatting error while preserving the meaningful doctest that verifies new process starts after quit(). This addresses linting compliance while maintaining documentation quality.
Documentation preview for this PR (built with commit b38bf8d; changes) is ready! 🎉 |
This test works for me (both from the command line and running |
@tscrim do you use system's fricas or sage's fricas?Thank you for your reply. |
@tscrim Thank you. I rebuild sage and fricas. But I found that
I run |
Fix FriCAS doctest pickling failures
Problem: Doctests in sage.interfaces.fricas were failing with TypeError: cannot pickle 'sage.misc.lazy_import.LazyImport' object when testing
fricas == loads(dumps(fricas))
.Solution: Replace the problematic equality test with isinstance(loads(dumps(a)), FriCAS) using a fresh FriCAS instance instead of the global fricas object, which contains unpicklable lazy imports.
Changes:
Modified doctests in
FriCAS.__init__
andFriCAS._quit_string
methodsPreserves serialization testing while avoiding LazyImport pickling issues
📝 Checklist
⌛ Dependencies