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

Test cases for check_bipartite_graph_bfs #10688

Merged

Conversation

RaymondDashWu
Copy link
Contributor

@RaymondDashWu RaymondDashWu commented Oct 19, 2023

Describe your change:

Contributes to #9943 . For maintainers: The automated tester is saying L65 needs tests but I'm not sure what it's asking for.

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?
  • Add test cases

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.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

@algorithms-keeper algorithms-keeper bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Oct 19, 2023
@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Oct 19, 2023
>>> check_bipartite(
... {0: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2], 4: [0]}
... )
False
Copy link
Member

@cclauss cclauss Oct 19, 2023

Choose a reason for hiding this comment

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

Please add some negative values, floating point values, and some strings.
Also,
{}
{7: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2], 4: [0]}
{0: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2], 9: [0]}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the additional test cases! I'll have to refactor the code a bit as it assumes that there's keys for all values from 0 to n. Will add different data types as well.

Copy link
Member

Choose a reason for hiding this comment

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

It is OK to fail if the input is not 1 to n or if other garbage data is provided. We just want to ensure the code does safe things in the face of garbage data. Raising a ValueError is safe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood. Thanks for the clarification!

@cclauss cclauss added the awaiting changes A maintainer has requested changes to this PR label Oct 19, 2023
@algorithms-keeper algorithms-keeper bot added tests are failing Do not merge until tests pass and removed awaiting changes A maintainer has requested changes to this PR labels Oct 19, 2023
@RaymondDashWu
Copy link
Contributor Author

RaymondDashWu commented Oct 20, 2023

The only failing error deals with an issue mentioned in #10717. I'll be moving on to another PR until that's fixed.

@algorithms-keeper algorithms-keeper bot removed awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Oct 20, 2023
@cclauss cclauss merged commit 82fc24c into TheAlgorithms:master Oct 20, 2023
@RaymondDashWu RaymondDashWu deleted the check_bipartite_graph_bfs_tests branch October 20, 2023 04:53
sedatguzelsemme pushed a commit to sedatguzelsemme/Python that referenced this pull request Sep 15, 2024
* [ADD] tests for check_bipartite_graph_bfs

* linter fix?

* linter fix

* [ADD] more test cases check_bipartite_graph_bfs

* doctest fixes. Forgot to add 'Traceback...'

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* missed a Traceback

* Update check_bipartite_graph_bfs.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
@isidroas isidroas mentioned this pull request Jan 25, 2025
14 tasks
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