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

fix: consider months and days in years_old #11234

Merged

Conversation

vil02
Copy link
Member

@vil02 vil02 commented Jan 11, 2024

Describe your change:

The doc-tests of calculate_age can fail depending on current time - all of the builds fail now (i.e. 01.2024). I suggest to simplify the calculate_age in such a way, that it will not take months into account (in general: the test is a specification of the function, so such approach is justified).

When this will be merged, I will rebase #11233, so the CI there will pass.

  • Fix a bug or typo in an existing algorithm?

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".

@vil02 vil02 marked this pull request as ready for review January 11, 2024 20:40
@vil02 vil02 requested a review from cclauss as a code owner January 11, 2024 20:40
@algorithms-keeper algorithms-keeper bot added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files labels Jan 11, 2024
@vil02 vil02 mentioned this pull request Jan 11, 2024
5 tasks
@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Jan 12, 2024
@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Jan 12, 2024
@cclauss cclauss changed the title fix: do not consider months in calculate_age fix: consider months and days in years_old Jan 12, 2024
@cclauss cclauss enabled auto-merge (squash) January 12, 2024 16:11
@cclauss cclauss merged commit 227944e into TheAlgorithms:master Jan 12, 2024
3 checks passed
@algorithms-keeper algorithms-keeper bot removed the awaiting reviews This PR is ready to be reviewed label Jan 12, 2024
@vil02 vil02 deleted the failing_test_of_calculate_age_patch branch January 12, 2024 17:31
cclauss added a commit to cclauss/Python that referenced this pull request Jan 13, 2024
* fix: do not consider months in `calculate_age`

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

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

* Update get_top_billionaires.py

* Update get_top_billionaires.py

* Update get_top_billionaires.py

* TODAY = datetime.utcnow()

* Update get_top_billionaires.py

* Update build.yml

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <[email protected]>
@cclauss cclauss mentioned this pull request Jan 15, 2024
15 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.

None yet

2 participants