Skip to content

some pytest on math folder #1405

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 4 commits into from
Oct 21, 2019
Merged

Conversation

engFelipeMonteiro
Copy link
Contributor

Hera are some pytest to simple math algorithms.

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

Nice initiative! Thanks. We need to figure out why pytest is not finding these tests.

https://travis-ci.com/TheAlgorithms/Python/builds/132684336#L416

maths/3n+1.py Outdated
@@ -32,6 +32,14 @@ def main():
)
)

def testn31():
Copy link
Member

Choose a reason for hiding this comment

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

test_n31() please. Also, please remove blank lines 37 and 39.

maths/abs.py Outdated
@@ -18,5 +18,13 @@ def main():
print(abs_val(-34)) # = 34


def testAbs():
Copy link
Member

Choose a reason for hiding this comment

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

test_abs_val() please. Also, please remove blank lines 23 and 25.

@@ -12,5 +12,13 @@ def main():
print(average([2, 4, 6, 8, 20, 50, 70]))


def testAverage():
Copy link
Member

Choose a reason for hiding this comment

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

test_average() please. Also, please remove blank lines 17 and 19.

if __name__ == "__main__":
main()
testAverage()
Copy link
Member

Choose a reason for hiding this comment

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

Leave just one blank line at the end of Python files.

@cozek
Copy link
Member

cozek commented Oct 20, 2019

Thank you for your contribution. However, I think the standard for tests in this repo is doctests.
I think you should add doctests instead.
Do read CONTRIBUTION.md for more clarification.

@cclauss
Copy link
Member

cclauss commented Oct 20, 2019

@cozek We need a pytest expert to help us understand why our non-doctest tests are not being discovered. https://docs.pytest.org/en/latest/goodpractices.html#test-discovery

Also format the code with psf/black as discussed in CONTRIBUTING.md
@cclauss cclauss merged commit f93cce6 into TheAlgorithms:master Oct 21, 2019
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* some pytest on math folder

* Run the test function via a doctest

Also format the code with psf/black as discussed in CONTRIBUTING.md

* Update abs.py

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

Successfully merging this pull request may close these issues.

3 participants