<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In the end, you have to be rigorous when writing tests, and for most<br>non-trivial functions it requires that you devise the distribution of<br>input values depending on the implemented algorithm, not leave that<br>distribution to a third-party library that knows nothing about your<br>program.<br></blockquote><div><br>Indeed. <br>But the great thing about the "hypothesis" tool is that it allows me to somewhat automate the generation of sets of input values based on my specific requirements derived from my knowledge of my program. <br>It allows me to think about what is the reasonable distribution of values for each argument in a function by either using existing strategies, using their arguments, combining and extending them, and them letting the tool do the grunt work of running the test for lots of different equivalent classes of argument values. <br>I think that as long as the tool user keeps what you said in mind and uses the tool accordingly it can be a great helper, and probably even force the average programmer to think more rigorously about the input values to be tested, not to mention the whole class of trivial mistakes and forgetfulness we are all bound to be subject when writing test cases.<br><br>Best,<br><br> </div></div><br><div class="gmail_quote"><div dir="ltr">Em qua, 28 de nov de 2018 às 12:18, Antoine Pitrou <<a href="mailto:solipsis@pitrou.net">solipsis@pitrou.net</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, 27 Nov 2018 22:47:06 -0600<br>
Abe Dillon <<a href="mailto:abedillon@gmail.com" target="_blank">abedillon@gmail.com</a>> wrote:<br>
> <br>
> If we could figure out a cleaner syntax for defining invariants,<br>
> preconditions, and postconditions we'd be half-way to automated testing<br>
> UTOPIA! (ok, maybe I'm being a little over-zealous)<br>
<br>
I think utopia is the word here.  Fuzz testing can be useful, but it's<br>
not a replacement for manual testing of carefully selected values.<br>
<br>
Also, the idea that fuzz testing will automatically find edge cases in<br>
your code is idealistic.  It depends on the algorithm you've<br>
implemented and the distribution of values chosen by the tester.<br>
Showcasing trivially wrong examples (such as an addition function that<br>
always returns 0, or a tail function that doesn't return the tail)<br>
isn't very helpful for a real-world analysis, IMHO.<br>
<br>
In the end, you have to be rigorous when writing tests, and for most<br>
non-trivial functions it requires that you devise the distribution of<br>
input values depending on the implemented algorithm, not leave that<br>
distribution to a third-party library that knows nothing about your<br>
program.<br>
<br>
Regards<br>
<br>
Antoine.<br>
<br>
<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Marcos Eliziário Santos<br>mobile/whatsapp/telegram: +55(21) 9-8027-0156</div><div>skype: <a href="mailto:marcos.eliziario@gmail.com" target="_blank">marcos.eliziario@gmail.com</a></div><div>linked-in : <a href="https://www.linkedin.com/in/eliziario/" target="_blank">https://www.linkedin.com/in/eliziario/</a></div><div><br></div></div></div>