Opened 8 months ago

Closed 7 months ago

#27117 closed enhancement (fixed)

Doctest Jupyter implementation of interact library

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-8.7
Component: doctest framework Keywords:
Cc: chapoton Merged in:
Authors: Jeroen Demeyer Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: dec85b1 (Commits) Commit: dec85b1c14fe0d47f91196ac825c5935949166b3
Dependencies: Stopgaps:

Description

The file src/sage/interacts/library.py has this snippet:

# Get a bunch of functions from the user globals. In SageNB, this will
# refer to SageNB functions; in Jupyter, this will refer to Jupyter
# functions. In the command-line and for doctests, we import the
# SageNB functions as fall-back.
for name in ("interact", "checkbox", "input_box", "input_grid",
        "range_slider", "selector", "slider", "text_control"):
    try:
        obj = get_global(name)
    except NameError:
        import sagenb.notebook.interact
        obj = sagenb.notebook.interact.__dict__[name]
    globals()[name] = obj

In other words, the doctest framework is testing the SageNB implementation of widgets. This should instead default to using the Jupyter implementation.

Change History (9)

comment:1 Changed 8 months ago by jdemeyer

  • Branch set to u/jdemeyer/doctest_jupyter_implementation_of_interact_library

comment:2 Changed 8 months ago by jdemeyer

  • Commit set to d6bfd45a050c46ce41e0cf61a4b14242e305a27e
  • Status changed from new to needs_review

New commits:

d6bfd45Doctest Jupyter implementation of interact library

comment:3 follow-up: Changed 8 months ago by chapoton

  • Status changed from needs_review to needs_work

easy doctest failures in

  • src/sage/plot/plot3d/plot3d.py and
  • src/sage/graphs/graph_database.py

comment:4 Changed 8 months ago by git

  • Commit changed from d6bfd45a050c46ce41e0cf61a4b14242e305a27e to dec85b1c14fe0d47f91196ac825c5935949166b3

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

f296bc8Doctest Jupyter implementation of interact library
dec85b1Further doctest fixes for Jupyter interacts

comment:5 in reply to: ↑ 3 Changed 8 months ago by jdemeyer

  • Status changed from needs_work to needs_review

Replying to chapoton:

easy doctest failures in

  • src/sage/plot/plot3d/plot3d.py

Fixed.

  • src/sage/graphs/graph_database.py

In this case, I removed the offending doctests. Part of it was copied verbatim from a different doctest and the rest wasn't really adding any value as test. Note that this code is sagenb-specific, so it cannot be run on Jupyter anyway.

comment:6 follow-up: Changed 8 months ago by chapoton

looks good, but this may interfere with #27126

comment:7 in reply to: ↑ 6 Changed 8 months ago by jdemeyer

Replying to chapoton:

looks good, but this may interfere with #27126

No, it's not touching the same file.

comment:8 Changed 8 months ago by chapoton

  • Reviewers set to Frédéric Chapoton
  • Status changed from needs_review to positive_review

indeed. Sorry for the noise. Then let it be.

comment:9 Changed 7 months ago by vbraun

  • Branch changed from u/jdemeyer/doctest_jupyter_implementation_of_interact_library to dec85b1c14fe0d47f91196ac825c5935949166b3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.