old_contents: from functools import wraps
  
  __version__ = '0.1.1'
  
  MAGIC = '%values'  # this value cannot conflict with any real python attribute
  
  
  def data(*values):
      """
      Method decorator to add to your test methods.
  
      Should be added to methods of instances of ``unittest.TestCase``.
      """
      def wrapper(func):
          setattr(func, MAGIC, values)
          return func
      return wrapper
  
  
  def ddt(cls):
      """
      Class decorator for subclasses of ``unittest.TestCase``.
  
      Apply this decorator to the test case class, and then
      decorate test methods with ``@data``.
  
      For each method decorated with ``@data``, this will effectively create as
      many methods as data items are passed as parameters to ``@data``.
      """
  
      def feed_data(func, *args, **kwargs):
          """
          This internal method decorator feeds the test data item to the test.
          """
          @wraps(func)
          def wrapper(self):
              return func(self, *args, **kwargs)
          return wrapper
  
      for name, f in cls.__dict__.items():
          if hasattr(f, MAGIC):
              i = 0
              for v in getattr(f, MAGIC):
                  setattr(cls,
                          "{0}_{1}".format(name, v),
                          feed_data(f, v))
                  i = i + 1
              delattr(cls, name)
      return cls
  
new_contents: from functools import wraps
  
  __version__ = '0.1.1'
  
  MAGIC = '%values'  # this value cannot conflict with any real python attribute
  
  
  def data(*values):
      """
      Method decorator to add to your test methods.
  
      Should be added to methods of instances of ``unittest.TestCase``.
      """
      def wrapper(func):
          setattr(func, MAGIC, values)
          return func
      return wrapper
  
  
  def ddt(cls):
      """
      Class decorator for subclasses of ``unittest.TestCase``.
  
      Apply this decorator to the test case class, and then
      decorate test methods with ``@data``.
  
      For each method decorated with ``@data``, this will effectively create as
      many methods as data items are passed as parameters to ``@data``.
      """
  
      def feed_data(func, *args, **kwargs):
          """
          This internal method decorator feeds the test data item to the test.
          """
          @wraps(func)
          def wrapper(self):
              return func(self, *args, **kwargs)
          return wrapper
  
      for name, f in cls.__dict__.items():
          if hasattr(f, MAGIC):
              i = 0
              for v in getattr(f, MAGIC):
                  test_name = getattr(v, "__name__", "{0}_{1}".format(name, v))
                  setattr(cls, test_name, feed_data(f, v))
                  i = i + 1
              delattr(cls, name)
      return cls
  
subject: Use __name__ from data object to set the test method name, if available.