#28867 closed defect (fixed)

1 imagemagick failing doctest in misc/latex.py

Reported by: slabbe Owned by:
Priority: major Milestone: sage-9.1
Component: misc Keywords:
Cc: chapoton Merged in:
Authors: Frédéric Chapoton Reviewers: Sébastien Labbé
Report Upstream: N/A Work issues:
Branch: c2c24c4 (Commits, GitHub, GitLab) Commit: c2c24c41d2cebc36aa3239030b0a802ba1c3d039
Dependencies: Stopgaps:

Status badges

Description

sage -t --optional=sage,imagemagick src/sage/misc/latex.py

gives

Using --optional=imagemagick,memlimit,sage
Doctesting 1 file.
sage -t src/sage/misc/latex.py
**********************************************************************
File "src/sage/misc/latex.py", line 1086, in sage.misc.latex.Latex.?
Failed example:
    latex.eval("\ThisIsAnInvalidCommand", {}) # optional -- ImageMagick
Exception raised:
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 681, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1123, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.latex.Latex.?[1]>", line 1, in <module>
        latex.eval("\ThisIsAnInvalidCommand", {}) # optional -- ImageMagick
      File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/misc/latex.py", line 1115, in eval
        O.write(str_to_bytes(x, encoding='utf-8'))
    TypeError: write() argument must be str, not bytes
**********************************************************************
1 item had failures:
   1 of   3 in sage.misc.latex.Latex.?
    [303 tests, 1 failure, 0.93 s]
----------------------------------------------------------------------
sage -t src/sage/misc/latex.py  # 1 doctest failed
----------------------------------------------------------------------

Change History (5)

comment:1 Changed 21 months ago by embray

  • Milestone changed from sage-9.0 to sage-9.1

Ticket retargeted after milestone closed

comment:2 Changed 20 months ago by slabbe

  • Cc chapoton added

Fredéric, I think you solved something similar in the past. Do you see easily a fix?

comment:3 Changed 20 months ago by chapoton

  • Authors set to Frédéric Chapoton
  • Branch set to u/chapoton/28867
  • Commit set to c2c24c41d2cebc36aa3239030b0a802ba1c3d039
  • Status changed from new to needs_review

Voilà. Y a de grandes chances que ca casse les doctests sous python2. A mon avis, y a pas moyen d'avoir les deux. Et c'est un doctest optionnel..


New commits:

c2c24c4trac 28867 py3 fix for latex

comment:4 Changed 20 months ago by slabbe

  • Reviewers set to Sébastien Labbé
  • Status changed from needs_review to positive_review

I confirm it fixes the issue for that optional doctest (9.1.beta2 running Python 3).

comment:5 Changed 20 months ago by vbraun

  • Branch changed from u/chapoton/28867 to c2c24c41d2cebc36aa3239030b0a802ba1c3d039
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.