title: Running unit tests on nested functions
body: <p>I come from the Java world, where you can hide variables and functions and then run unit tests against them using reflection.  I have used nested functions to hide implementation details of my classes so that only the public API is visible.  I am trying to write unit tests against these nested functions to make sure that I don't break them as I develop.  I have tried calling one of the nested functions like:</p>
  
  <pre><code>def outer():
      def inner():
          pass
  
  outer.inner()
  </code></pre>
  
  <p>which results in the error message:</p>
  
  <blockquote>
    <p>AttributeError: 'function' object has no attribute 'inner'</p>
  </blockquote>
  
  <p>Is there a way for me to write unit tests against these nested functions?  If not, is there a way to trigger the name munging for function names like you can for class variables by prefixing them with __?</p>