title: Is it pythonic to use the '__main__' mechanism to test the module?
body: <p>Suppose we have the following module:</p>
  <pre class="lang-py prettyprint-override"><code># my_module.py
  
  def my_sum(a, b):
      return a + b + 1
  
  if __name__ == '__main__':
      s = my_sum(2, 3)
      print(s)
  </code></pre>
  <p>How bad / good / pythonic is it to test my modules or parts of them like that?</p>
  <p>EDIT: I'm not saying or asking whether everything should be tested like that. What I mean is, if I am lazy and the module is not critical, would it be an idiomatic way to get things done quickly?</p>