Skip to content

Add doctest and fix mypy type annotation in bellman ford #4506

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

Merged
merged 1 commit into from
Jun 24, 2021

Conversation

mhihasan
Copy link
Contributor

@mhihasan mhihasan commented Jun 12, 2021

Describe your change:

  • Add doctest and
  • fix mypy type annotation in bellman ford

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

related issue #4052

@ghost ghost added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed labels Jun 12, 2021
@mhihasan mhihasan force-pushed the fix/bellman_ford branch 2 times, most recently from 86d05f3 to e1327cd Compare June 12, 2021 19:13
"""
Returns shortest paths from a vertex src to all
other vertices.
>>> edges = [(2, 1, -10), (3, 2, 3), (0, 3, 5), (0, 1, 4)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just create test_edges at global scope and then use them here and also at line 46.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will look into it

Copy link
Contributor Author

@mhihasan mhihasan Jun 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, edges is being used here only. So, it has not been declared globally.

@mhihasan
Copy link
Contributor Author

Are any other change suggestions left?

@ghost ghost removed the awaiting reviews This PR is ready to be reviewed label Jun 24, 2021
@cclauss cclauss merged commit 3ea5a13 into TheAlgorithms:master Jun 24, 2021
shermanhui pushed a commit to shermanhui/Python that referenced this pull request Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This PR modified some existing files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants