¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: Tests ¡°scoped¡± to implementation


 

¿ªÔÆÌåÓý

I suppose that's what one is supposed to do with that example. :)

R

On Jan 16, 2020, at 1:06 PM, Tim Ottinger <tottinge@...> wrote:

I don¡¯t know how many tests you really need for a python one-liner like that.

`return any((sum(pair)==6) for pair in permutations(list, 2))`

Check empty list returns false?
Check for no matches
Check for one match
Check for invalid input handling

There really aren¡¯t many invariants to lock down for refactoring purposes.
I guess you could do more than that, but at some point you¡¯re testing the compiler and the library (someone else¡¯s code) and not your algorithm.


Ron Jeffries
If it is more than you need, it is waste. -- Andy Seidl

Join [email protected] to automatically receive all group messages.