On Sep 9, 2013 8:51 PM, "CsquaredinOmaha" <[email protected]> wrote: > > > For a while I had thought it would be interesting to hear "tips/techniques you > find yourself often using" - or perhaps found useful at one point (and thus would be valuable to newbies). > > It could be simple snippet, or some description of logic, technique or steps. > From simple to sophisticated is less the issue - more that you "found it handy and used it alot". > > Whatever use area: ETL data files, servers, SQL maintenance, webcrawlers, anything.
== Writing tests as top-level functions as opposed to methods of a unittest.TestCase subclass == Aside from the obvious advantage of eliminating ceremony, this has the effect of forcing me to make sure that each test is entirely and atomically independent of other tests. That way, I only ever have to read one function to understand the nature of a given test failure. Also, not having the ability to easily slap on setup/teardown functions/methods forces me to make tests self-contained. Add in the heuristic that tests with long/complicated arrange and/or act sections are indicative of potential design flaws and you have the requisite TDD feedback. It also helps tremendously that both nosetest and pytest support this idiom. - d _______________________________________________ BangPypers mailing list [email protected] https://mail.python.org/mailman/listinfo/bangpypers
