Ask Your Question

DavidAyotte's profile - activity

2021-03-11 04:02:46 +0200 marked best answer The function run_doctests creates a TypeError

Hello everyone,

I've been writing a sage module in which I've written some documentation examples and tests. I wanted to run a doctest just to verify if everything is correct but function "run_doctests" seems to introduce a non-expected bug in the software. Here's an exampe:

sage: run_doctests("module.sage")
too few successful tests, not using stored timings
Running doctests with ID 2021-03-10-10-13-36-df8ccbc8.
Using --optional=sage
Doctesting 1 file.
sage -t /path-to-module.sage
    [40 tests, 0.07 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 0.1 seconds
    cpu time: 0.1 seconds
    cumulative wall time: 0.1 seconds
sage: M = ModularForms()
sage: M
    Modular Forms space of dimension 0 for Modular Group SL(2,Z) of weight 2 over Rational Field
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/usr/lib/python3/dist-packages/sage/all_cmdline.py in <module>
----> 1 M

/usr/lib/python3/dist-packages/IPython/core/displayhook.py in __call__(self, result)
    260             self.start_displayhook()
    261             self.write_output_prompt()
--> 262             format_dict, md_dict = self.compute_format_data(result)
    263             self.update_user_ns(result)
    264             self.fill_exec_result(result)

/usr/lib/python3/dist-packages/IPython/core/displayhook.py in compute_format_data(self, result)
    149 
    150         """
--> 151         return self.shell.display_formatter.format(result)
    152 
    153     # This can be set to True by the write_output_prompt method in a subclass

/usr/lib/python3/dist-packages/sage/repl/display/formatter.py in format(self, obj, include, exclude)
    198         """
    199         # First, use Sage rich output if there is any
--> 200         sage_format, sage_metadata = self.dm.displayhook(obj)
    201         assert PLAIN_TEXT in sage_format, 'plain text is always present'
    202         if not set(sage_format.keys()).issubset(self.default_mime()):

TypeError: cannot unpack non-iterable NoneType object

Here's more info about the error: it happens whenever I use the run_doctests function. The run_doctests seems to work as it should. However, the problem occurs after I used this function. For example, If I define any object from any class (in my example ModularForms), then when use the special method _repr_ of that object I obtain this error message. I don't think this have anything to do with the ModularForms class.

Do anybody else know what could introduce this error? I was wondering if this error comes from my module or from Sagemath. In my module, I've been following the general conventions of the developper guide.

I've tried both SageMath version 9.0 (from the debian SID package) and SageMath version 9.3.beta8 (compiled from source) and I've got the same error with both versions. If this error comes from the software, I shall open a sage-trac ticket about this issue.

Thank you very much in advance!

edit: I added more information about the issue.

2021-03-11 04:02:46 +0200 received badge  Scholar (source)
2021-03-11 04:02:45 +0200 received badge  Supporter (source)
2021-03-11 04:02:36 +0200 commented answer The function run_doctests creates a TypeError

Oh, thanks for pointing this ticket to me. I wasn't aware of it. I guess that I will just do the tests in the console as

2021-03-10 22:11:49 +0200 received badge  Student (source)
2021-03-10 21:16:49 +0200 commented answer The function run_doctests creates a TypeError

In other words, run_doctests is buggy and should not be used? Has anyone ever investigated the nature of those bugs?

2021-03-10 19:57:10 +0200 edited question The function run_doctests creates a TypeError

The function run_doctests creates a TypeError Hello everyone, I've been writing a sage module in which I've written som

2021-03-10 19:55:56 +0200 edited question The function run_doctests creates a TypeError

The function run_doctests creates a TypeError Hello everyone, I've been writing a sage module in which I've written som

2021-03-10 17:13:20 +0200 received badge  Editor (source)
2021-03-10 17:13:20 +0200 edited question The function run_doctests creates a TypeError

The function run_doctests creates a TypeError Hello everyone, I've been writing a sage module in which I've written som

2021-03-10 16:58:09 +0200 asked a question The function run_doctests creates a TypeError

The function run_doctests creates a TypeError Hello everyone, I've been writing a sage module in which I've written som