Standard idiom for testing individual functions?

Mark McEahern marklists at mceahern.com
Wed Aug 7 13:58:19 CEST 2002


def foo():
  pass

def bar():
  pass

import unittest

class TestMyStuff(unittest.TestCase):

  def test_foo(self):
    f = foo()
    self.failUnless(f is None)

  def test_bar(self):
    b = bar()
    self.failUnless(b is None)

if __name__ == "__main__":
  unittest.main()

// m
-





More information about the Python-list mailing list