Changeset - 2a7cbc53f65a
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2013-03-31 19:26:52
marcin@python-works.com
fixed nose parametrized when used on objects
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/tests/nose_parametrized.py
Show inline comments
 
@@ -83,25 +83,25 @@ def parameterized(input):
 
    return parameterized_helper
 

	
 

	
 
def to_safe_name(s):
 
    return re.sub("[^a-zA-Z0-9_]", "", s)
 

	
 

	
 
def parameterized_expand_helper(func_name, func, args):
 
    def parameterized_expand_helper_helper(self=()):
 
        if self != ():
 
            self = (self,)
 
        return func(*(self + args))
 
    parameterized_expand_helper_helper.__name__ = func_name
 
    parameterized_expand_helper_helper.__name__ = str(func_name)
 
    return parameterized_expand_helper_helper
 

	
 

	
 
def parameterized_expand(input):
 
    """ A "brute force" method of parameterizing test cases. Creates new test
 
        cases and injects them into the namespace that the wrapped function
 
        is being defined in. Useful for parameterizing tests in subclasses
 
        of 'UnitTest', where Nose test generators don't work.
 

	
 
        >>> @parameterized.expand([("foo", 1, 2)])
 
        ... def test_add1(name, input, expected):
 
        ...     actual = add1(input)
0 comments (0 inline, 0 general)