Follow @RoyOsherove on Twitter

The Zen of python should be the zen of good unit testing

I’ve come across the “zen of python”. A list of siple rules for style and thought. Overall, I’ve heard that python folks like to be more explicit, and I always felt it’s a good idea. but when I came across the full list, I can see how I believe in most of these thigns when I teach my students about readable, maintinable tests:

The zen of unit testing:

    Beautiful is better than ugly.
    Explicit is better than implicit.
    Simple is better than complex.
    Complex is better than complicated.
    Flat is better than nested.
    Sparse is better than dense. (? not sure what this means)
    Readability counts.
    Special cases aren't special enough to break the rules. (? not sure it's tru for unit testing style)
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the temptation to guess.
    There should be one-- and preferably only one --obvious way to do it.
    Although that way may not be obvious at first unless you're Dutch. (uh.. yeah)
    Now is better than never.
    Although never is often better than *right* now.
    If the implementation is hard to explain, it's a bad idea.
    If the implementation is easy to explain, it may be a good idea.
    Namespaces are one honking great idea -- let's do more of those! (not sure..)

Hire me for a day or two in Oslo, in June

NEW: Ruby podcast in hebrew