Opened 4 years ago

Closed 4 years ago

#27183 closed enhancement (fixed)

py3: fix doctest in generic_graph (part 5)

Reported by: David Coudert Owned by:
Priority: major Milestone: sage-8.7
Component: graph theory Keywords: py3, graph
Cc: Jean-Florent Raymond Merged in:
Authors: David Coudert Reviewers: Jean-Florent Raymond
Report Upstream: N/A Work issues:
Branch: 78ba5cf (Commits, GitHub, GitLab) Commit: 78ba5cf18db16b04fb0139fd7cb2c89e5c6647de
Dependencies: Stopgaps:

Status badges

Description (last modified by David Coudert)

Fix doctests in

  • lex_BFS: mark some doctests as py2 or py3
  • _color_by_label: mark some doctests as py2 or py3
  • layout_extend_randomly: mark a doctest as # random and add another test

Change History (7)

comment:1 Changed 4 years ago by David Coudert

Branch: public/27183_generic_graph_5
Commit: df372582a521ae1c6d3de025a0074bf813b855bf
Status: newneeds_review

New commits:

df37258trac #27183: other doctests

comment:2 Changed 4 years ago by Jean-Florent Raymond


when running the tests on I got:

File "src/sage/graphs/", line 18636, in sage.graphs.generic_graph.GenericGraph.layout_extend_randomly
Failed example:
    H.layout_extend_randomly({('0', 0): (0, 0), ('1', 1): (1, 1)})  # py3
    {('0', 0): (0, 0),
     ('0', 1): [0.1114..., 0.514...],
     ('1', 0): [0.0446..., 0.332...],
     ('1', 1): (1, 1)}
    {('0', 0): (0, 0),
     ('0', 1): [0.04468968524815642, 0.332490606442413],
     ('1', 0): [0.111439293741037, 0.5143475134191677],
     ('1', 1): (1, 1)}

It is not surprising as the results are supposed to be random. Is there a way to specify this in the doctests? (or to set the random seed to a fixed value before running the tests?)

comment:3 Changed 4 years ago by Jean-Florent Raymond

Cc: Jean-Florent Raymond added

comment:4 Changed 4 years ago by git

Commit: df372582a521ae1c6d3de025a0074bf813b855bf78ba5cf18db16b04fb0139fd7cb2c89e5c6647de

Branch pushed to git repo; I updated commit sha1. New commits:

d0dc10atrac #27183: Merged with 8.7.beta3
78ba5cftrac #27183: better doctest in layout_extend_randomly

comment:5 Changed 4 years ago by David Coudert

Description: modified (diff)

I changed the doctest to mark the output as random and added a test on the bounding box.

comment:6 Changed 4 years ago by Jean-Florent Raymond

Reviewers: Jean-Florent Raymond
Status: needs_reviewpositive_review

Thank you.

comment:7 Changed 4 years ago by Volker Braun

Branch: public/27183_generic_graph_578ba5cf18db16b04fb0139fd7cb2c89e5c6647de
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.