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