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
Expected ValueError when calling set_vertex() #27399
Comments
Commit: |
comment:2
The branch is not clean, but it is mixed up with another branch. |
New commits:
|
Changed branch from u/gh-Rithesh17/set_vertices-modified to u/gh-Rithesh17/set_vertex-modified |
comment:4
Welcome to Sagemath! The following changes are needed in your patch:
- ValueError: vertex (1) not in the graph.
- Please use add_vertex() method to add the vertex to the graph before setting it to the object.
+ ValueError: vertex (4) not in the graph and - if not self._backend.has_vertex(vertex):
- raise ValueError('vertex (%s) not in the graph.\nPlease use add_vertex() method to add the vertex to the graph before setting it to the object.'%str(vertex))
+ if vertex not in self:
+ raise ValueError('vertex (%s) not in the graph'%str(vertex)) To check that the changes you do are OK, you must run the doctests using for instance
|
Changed branch from u/gh-Rithesh17/set_vertex-modified to u/gh-Rithesh17/set_vertex-mod |
comment:5
Thank you for the review. I have adopted all the suggestions provided. I ran the doctests and this was the output:
New commits:
|
comment:6
A minor issue: remove the This is PEP8. |
Reviewer: David Coudert |
comment:8
Further small remarks: - sage: T.set_vertex(4, graphs.DodecahedralGraph())
+ sage: T.set_vertex(4, 'foo') There is no need to build the graph here as we just want to show that it is not possible to set label of a non existing vertex. Running all doctests is long, so when we can illustrate an issue with a smaller/faster example, it's always better. - raise ValueError('vertex (%s) not in the graph'%str(vertex))
+ raise ValueError('vertex (%s) not in the graph' % str(vertex)) this is also PEP8. |
comment:10
For me this patch is good to go. |
Changed branch from u/gh-Rithesh17/set_vertex-mod to |
This is the issue discussed in the comments section of the ticket #14708:
We should have expected a ValueError in the
set_vertex()
method. Also, on continuing,Which shouldn't have happened
Component: graph theory
Author: Rithesh K
Branch/Commit:
94ab6e8
Reviewer: David Coudert
Issue created by migration from https://trac.sagemath.org/ticket/27399
The text was updated successfully, but these errors were encountered: