Skip to content

Commit

Permalink
Trac #33170: Update doctests for compatibility with ipython 8.x
Browse files Browse the repository at this point in the history
Besides trivial output format changes, the only breakage seems to be
tracebacks no longer showing cython source code
{{{
**********************************************************************
File "src/sage/repl/interpreter.py", line 77, in sage.repl.interpreter
Failed example:
    print("dummy line"); shell.run_cell('1/0') # see #25320 for the
reason of the `...` and the dummy line in this test
Expected:
    dummy line
    ...
    ZeroDivisionError...Traceback (most recent call last)
    <ipython-input-...> in <module>...
    ----> 1 Integer(1)/Integer(0)
    .../sage/rings/integer.pyx in sage.rings.integer.Integer...div...
    ...
    -> ...                  raise ZeroDivisionError("rational division
by zero")
       ...            x = <Rational> Rational.__new__(Rational)
       ...            mpq_div_zz(x.value, ....value,
(<Integer>right).value)
    <BLANKLINE>
    ZeroDivisionError: rational division by zero
Got:
    dummy line
    --------------------------------------------------------------------
-------
    ZeroDivisionError                         Traceback (most recent
call last)
    Input In [1], in <module>
    ----> 1 Integer(1)/Integer(0)
    <BLANKLINE>
    File /usr/lib/python3.10/site-packages/sage/rings/integer.pyx:1987,
in sage.rings.integer.Integer.__truediv__
(build/cythonized/sage/rings/integer.c:13679)()
    <BLANKLINE>
    ZeroDivisionError: rational division by zero
**********************************************************************
}}}
The update itself requires a bunch of new dependencies

URL: https://trac.sagemath.org/33170
Reported by: arojas
Ticket author(s): Antonio Rojas
Reviewer(s): Gonzalo Tornaría
  • Loading branch information
Release Manager committed Mar 20, 2022
2 parents 2fbf359 + 4d2b53f commit f06a7f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/sage/repl/interface_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def cell_magic_factory(self):
2
120
sage: shell.run_cell('%%gap foo\n1+1;\n')
...File "<string>", line unknown
...File...<string>...
SyntaxError: Interface magics have no options, got "foo"
<BLANKLINE>
sage: shell.run_cell('%%gap?')
Expand Down
6 changes: 3 additions & 3 deletions src/sage/repl/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@
dummy line
...
ZeroDivisionError...Traceback (most recent call last)
<ipython-input-...> in <module>...
...
----> 1 Integer(1)/Integer(0)
.../sage/rings/integer.pyx in sage.rings.integer.Integer...div...
.../sage/rings/integer.pyx... in sage.rings.integer.Integer...div...
...
-> ... raise ZeroDivisionError("rational division by zero")
....: x = <Rational> Rational.__new__(Rational)
Expand Down Expand Up @@ -421,7 +421,7 @@ def SagePreparseTransformer(lines):
sage: from sage.repl.interpreter import get_test_shell
sage: shell = get_test_shell()
sage: shell.run_cell(bad_syntax)
File "<string>", line unknown
File...<string>...
SyntaxError: Mismatched ']'
<BLANKLINE>
sage: shell.quit()
Expand Down

0 comments on commit f06a7f8

Please sign in to comment.