""" Introduction to Test-driven Development We're going to implement a simple algorithm using the "Test-driven Development" methodology. TDD works like this: 1. Never write a single line of code unless you have a failing automated test. 2. Eliminate duplication. We're going to concentrate on step 1. Interestingly, it turns out that the most important question in software development (from my POV, anyway) is: How do you know when you're done? TDD offers an answer: "When all your tests pass." What's a test? http://en.wikipedia.org/wiki/Test-driven_development """ def intlist(n): text = str(n) # in order to "split up" the integer we have to treat it as a string digits = list(text) integers = [int(x) for x in digits] # now convert them back to digits. return integers def test_adder(n): pass def test_intlist(n): return assert intlist(123) == [1,2,3] print intlist(123)