Opened 3 years ago

Closed 3 years ago

#27183 closed enhancement (fixed)

py3: fix doctest in generic_graph (part 5)

Reported by: dcoudert Owned by:
Priority: major Milestone: sage-8.7
Component: graph theory Keywords: py3, graph
Cc: gh-jfraymond 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 dcoudert)

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 3 years ago by dcoudert

  • Branch set to public/27183_generic_graph_5
  • Commit set to df372582a521ae1c6d3de025a0074bf813b855bf
  • Status changed from new to needs_review

New commits:

df37258trac #27183: other doctests

comment:2 Changed 3 years ago by gh-jfraymond


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 3 years ago by gh-jfraymond

  • Cc gh-jfraymond added

comment:4 Changed 3 years ago by git

  • Commit changed from df372582a521ae1c6d3de025a0074bf813b855bf to 78ba5cf18db16b04fb0139fd7cb2c89e5c6647de

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 3 years ago by dcoudert

  • Description modified (diff)

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

comment:6 Changed 3 years ago by gh-jfraymond

  • Reviewers set to Jean-Florent Raymond
  • Status changed from needs_review to positive_review

Thank you.

comment:7 Changed 3 years ago by vbraun

  • Branch changed from public/27183_generic_graph_5 to 78ba5cf18db16b04fb0139fd7cb2c89e5c6647de
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.