Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There's a better way: get red of can or should, and just assert its truth.

- handles_negative_input

- handles_zero

- returns_http_error_code



I don't think this necessarily goes against the author's point. I think encouraging "should" was just a means to an end.


Personally, I prefer to name them as code examples instead of as tests:

- negative_input

- zero_input

- bad_request

When you run the "bad_request" test, you should get an error code, but that's on the assert already.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: