title: TDD unit tests can call other functions?
body: <p>I've discovered TDD on Python using the excellent book (<a href="http://www.obeythetestinggoat.com/" rel="nofollow">Test Driven Development in Python</a>), and so far, I'm enjoying it.</p>
  
  <p>However, I've a question regarding the way you create Unit test.</p>
  
  <p>Let's imagine something like this :</p>
  
  <pre><code>def A(MyObject):
      # Do some complex modification on MyObject
      return modified_MyObject
  
  def B(modified_MyObject):
      # Do some stuff on modified_MyObject
      return something
  </code></pre>
  
  <p>If I want to test A, it'll be pretty simple : I'll create a object manually in my unit test, and test it, something like this :</p>
  
  <pre><code>class TestObject(unittest.TestCase):
  
      def testA(self):
          testA = MyObject()
          modified_MyObject = A(testA)
          # assert MyObject has been modified
  </code></pre>
  
  <p>However, how to test B ?
  I can see to way :</p>
  
  <ul>
  <li>creating manually a "modified_MyObject" and use it to test B</li>
  <li>using A() in testB() to create a modified_MyObject</li>
  </ul>
  
  <p>The first method allows testB not be dependent of A(), but I will then create a "constant" object, which is apparently something to avoid in TDD. Moreover, if I changed something in my code, I'll have to modify also my created object. Finally, if the modification done on my object implies hundreds of steps / data, it can be a real pain to create the object by hand.</p>
  
  <p>The second method is making a dependance between A() &amp; testB, but as I'm testing also A(), it should be ok.</p>
  
  <pre><code>    def testB(self):
          testA = MyObject()
          testModifiedObject = A(testA)
          result = B(testModifiedObject)
          # assert that B return a correct result.
  </code></pre>
  
  <p>The general question could be : "in TDD, if code functions are using other functions, can I use them as well in my unit tests ?"</p>
  
  <p>Thanks for your help,</p>