Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

py3: fix doctests in vertex_separation.pyx #27151

Closed
dcoudert opened this issue Jan 27, 2019 · 10 comments
Closed

py3: fix doctests in vertex_separation.pyx #27151

dcoudert opened this issue Jan 27, 2019 · 10 comments

Comments

@dcoudert
Copy link
Contributor

Several failing doctests were caused by the impossibility to sort of list of Set (already in Python2).

sage: from sage.graphs.graph_decompositions.vertex_separation import vertex_separation, linear_ordering_to_path_decomposition
sage: g = graphs.PathGraph(5)
sage: pw, L = vertex_separation(g, algorithm="BAB"); pw
1
sage: h = linear_ordering_to_path_decomposition(g, L)
sage: sorted(h)
[{0, 1}, {3, 4}, {2, 3}, {1, 2}]

Since path decomposition is a graph whose vertices are Set, we get different results in py2 and py3.
=> we mark doctests as # py2 and # py3.

Some doctests were due to a max(None, <number>). With a proper initialization of the cut_off variable, we don't have this issue anymore.

Another doctest is fixed in #27027.

Component: graph theory

Author: David Coudert

Branch/Commit: 206f496

Reviewer: Vincent Klein

Issue created by migration from https://trac.sagemath.org/ticket/27151

@dcoudert dcoudert added this to the sage-8.7 milestone Jan 27, 2019
@dcoudert
Copy link
Contributor Author

Branch: u/dcoudert/27151_vertex_separation

@dcoudert
Copy link
Contributor Author

Commit: 7fa6d9f

@dcoudert
Copy link
Contributor Author

comment:1

The 10 failing doctests in py3 should be fixed with this ticket and #27027.


New commits:

7fa6d9ftrac #27151: fix doctests in vertex_separation

@vinklein
Copy link
Mannequin

vinklein mannequin commented Jan 31, 2019

Reviewer: Vincent Klein

@vinklein
Copy link
Mannequin

vinklein mannequin commented Jan 31, 2019

comment:2

Hi !

I don't think all the # py2 # py3 are necessary.
For example for your two first modifications doing that :

sage: sorted(h.vertices(), key=str)
[{0, 1}, {1, 2}, {2, 3}, {3, 4}]
sage: sage: sorted(h.edges(labels=None), key=str)
[({0, 1}, {1, 2}), ({1, 2}, {2, 3}), ({2, 3}, {3, 4})]

give the same results in both py2 and py3.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 31, 2019

Changed commit from 7fa6d9f to 206f496

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 31, 2019

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

206f496trac #27151: implement reviewer's comments

@dcoudert
Copy link
Contributor Author

comment:4

Very good idea. Thanks. I have changed 3 doctests. One pair of py2/py3 tags remains as I don't know how to avoid it.

@vinklein
Copy link
Mannequin

vinklein mannequin commented Jan 31, 2019

comment:5

Ok this looks fine.

@vbraun
Copy link
Member

vbraun commented Feb 4, 2019

Changed branch from u/dcoudert/27151_vertex_separation to 206f496

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants