-
-
Notifications
You must be signed in to change notification settings - Fork 3
Updates according to discussion in issues [closes #13, #14, #17, #19, #20, #21, #23, #25, #26, #28] #29
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
base: gh-pages
Are you sure you want to change the base?
Conversation
@pytest.mark.parametrize("a, b, expect", [ | ||
([1, 2, 3], [4, 5, 6], [5, 7, 9]), | ||
([-1, -5, -3], [-4, -3, 0], [-5, -8, -3]), | ||
ids=['positve','negative'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- comma at eol
- space after comma
- use double quotes rather than single (or at least be consistent)
(Lots of other instances of each; I won't tag all of them)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, haven't run it through black
admittedly. It is just a great illustration of how annoying the absence of autoformatting is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just spotted the word positve
here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the square bracket started on line 185 should be closed before line 188.
>> such a case, it is equally important to test that the integration of the | ||
>> various individually tested units worked correctly. Such integration tests | ||
>> will be run less often than unit tests and might be more meaningful for more | ||
>> realistic circumstances. For such -- and definitely for the even broader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Markdown doesn't automatically turn --
into –
, so either use –
or –
>> different words, potentially different capitalisation and spellings, | ||
>> additional punctuation and maybe special characters that your function may or | ||
>> may not handle correctly. You might need a lot of different test strings to | ||
>> cover all these cases (and combinations thereof). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things I might make explicit here:
- Trying to write lots of tiny test strings by hand that cover every possible eventuality might still not cover everything that a real book did. (You could of course correctly argue that you could add tests for such eventualities as specific unit tests as you found them, but that doesn't mean that you shouldn't also test with some real data.)
- If you want to test with real data, relying on an external source to get them may not be the best option, for the reasons you discuss. You can include data files to use as fixtures instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I made the first point already but I will try to be more explicit about that.
> you are supposed to commit often and, hence, committing should be a fast and | ||
> lightweight action. Therefore, the pre-commit developers explicitly discourage | ||
> running expensive test suites as a pre-commit hook. | ||
> {: .callout} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{: .callout}
should sit outside indented block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooops!
@@ -366,3 +383,4 @@ next to the first commit, a green tick (passed) next to the second, and nothing | |||
[pypi]: https://pypi.org | |||
[starter-workflows]: https://github.com/actions/starter-workflows | |||
[yaml]: https://en.wikipedia.org/wiki/YAML | |||
[pre-commit]: https://pre-commit.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alphabetise links
almost impossible to predict. Fuzzy testing is a strategy where you let the | ||
computer run your code with random input (sometimes down to the bit level) and | ||
make sure that not even the most far-fetched input can break your code. There | ||
are libraries for that, so you don't have to set up all the boilerplate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth explicitly mentioning one or two such libraries here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of Hypothesis here, but on consideration I think that would be a slightly separate bullet again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't done fuzzy testing myself, yet, so I neither have opinions nor experience. I know about Hypothesis but I guess the any link I can provide is about as reliable as their own answer to hacking "fuzzy testing python" into their preferred search engine. If you have suggestions, I'd say you add that after the pull request is through, okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used Hypothesis a couple of times and it's good; I've not worked with other kinds of fuzzer though so have no suggestions on that front. Happy to add a bullet after merging.
conditions of the bug in code form and it might be an important information if | ||
a bug disappeared unexpectedly. Maybe another code change had an effect you | ||
did not intend? | ||
* **test for fixing an external interface** - You can even test code did not write |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth mentioning that this is relatively controversial and that having a large battery of tests of other people's code is a code smell (in nicer terms)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree. In a flat list like this, it looks like having the same status as other forms of testing which is definitely not true. Should be sparse and only where really needed. I would however say that you are not at all testing other people's code (in terms of functionality) in that you definitely shouldn't have 100 tests that numpy can correctly add two arrays but you automate the detection of interface changes. Your tests should be designed for that purpose and that purpose alone and they will automatically be sparse and effective that way.
@@ -34,23 +117,29 @@ the different bacteria are. It already has tests written for most functions. | |||
> the badges. | |||
> 4. Create a virtual environment on your computer for the project, and install | |||
> the project's requirements, so you can run the test suite locally. | |||
> 5. Currently, some of the tests for the repository fail. Work out why this is | |||
> 5. The current code is very outdated by now and you will see in a moment that | |||
> it does not work with a standard contemporary python installation anymore. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
capitalise Python
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, wow! Python itself capitalises it. I could have sworn that the brand name is lowercase.
@@ -64,3 +153,5 @@ the different bacteria are. It already has tests written for most functions. | |||
|
|||
|
|||
[pl-curves]: https://github.com/CDT-AIMLAC/pl_curves | |||
[pytest_features]: https://edbennett.github.io/python-testing-ci/02-pytest-functionality/index.html | |||
[edge_cases]: https://edbennett.github.io/python-testing-ci/04-edges/index.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e
before p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the code is kept in the code
directory as well as having a zipped version for learners to download; please commit the modified code into that directory as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, didn't see that.
No description provided.