Fix with get_defining_class on py33
This commit is contained in:
@@ -161,8 +161,8 @@ class parameterized(object):
|
||||
if len(stack) <= 4:
|
||||
return []
|
||||
frame = stack[4]
|
||||
code_context = frame[4][0].strip()
|
||||
if not code_context.startswith("class "):
|
||||
code_context = frame[4] and frame[4][0].strip()
|
||||
if not (code_context and code_context.startswith("class ")):
|
||||
return []
|
||||
_, parents = code_context.split("(", 1)
|
||||
parents, _ = parents.rsplit(")", 1)
|
||||
|
@@ -50,7 +50,7 @@ def test_warns_when_using_parameterized_with_TestCase():
|
||||
try:
|
||||
class TestTestCaseWarnsOnBadUseOfParameterized(TestCase):
|
||||
@parameterized([42])
|
||||
def test_should_throw_error(self, foo):
|
||||
def test_in_subclass_of_TestCase(self, foo):
|
||||
pass
|
||||
except Exception as e:
|
||||
assert_contains(str(e), "parameterized.expand")
|
||||
|
Reference in New Issue
Block a user