Commit 9b6b2b96 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

test_generator: assert correct usage as decorator

Added an assertion to check test_generator has be instantiated
correctly, instead of the class itself being used as a decorator.
parent 2d0d46f4
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ A module to increase test re-use, by running tests with multiple argument sets.
"""

import unittest
from collections import Iterable
from collections import Iterable, Callable
from functools import wraps
from six import string_types

@@ -85,7 +85,11 @@ class test_generator(object):
	  ```
	"""

	def __init__(self, values):
	def __init__(self, values=None):
		assert not isinstance(values, Callable) \
		       or isinstance(values, Iterable), \
			"You must use an instance of {0}, not {0} itself as a test " \
			"decorator.".format(self.__class__.__name__)
		self.values = values

	def __call__(self, func):