summaryrefslogtreecommitdiff
path: root/tests/utils
diff options
context:
space:
mode:
authorDavid Cramer <dcramer@gmail.com>2012-12-26 13:34:57 -0800
committerDavid Cramer <dcramer@gmail.com>2012-12-26 13:34:57 -0800
commita4e19855e906117d0502993a9d54f94d9e4c9e95 (patch)
treef6b7873dac7d5a022e0e0b0bee3452b9c60d92e6 /tests/utils
parente2a56d9a20f6aa83b83a1ddc6ef4a7d71cc6debd (diff)
downloadraven-a4e19855e906117d0502993a9d54f94d9e4c9e95.tar.gz
Correct behavior of get_culprit and improve tests
Diffstat (limited to 'tests/utils')
-rw-r--r--tests/utils/stacks/tests.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/utils/stacks/tests.py b/tests/utils/stacks/tests.py
index b0b979d..c0be266 100644
--- a/tests/utils/stacks/tests.py
+++ b/tests/utils/stacks/tests.py
@@ -15,24 +15,27 @@ class Context(object):
iterkeys = lambda s, *a: s.dict.iterkeys(*a)
-class StackTest(TestCase):
- def test_get_culprit_bad_module(self):
+class GetCulpritTest(TestCase):
+ def test_empty_module(self):
culprit = get_culprit([{
'module': None,
'function': 'foo',
}])
- self.assertEquals(culprit, '<unknown>.foo')
+ assert culprit == '<unknown>.foo'
+ def test_empty_function(self):
culprit = get_culprit([{
'module': 'foo',
'function': None,
}])
- self.assertEquals(culprit, 'foo.<unknown>')
+ assert culprit == 'foo.<unknown>'
+
+ def test_no_module_or_function(self):
+ culprit = get_culprit([{}])
+ assert culprit == '<unknown>.<unknown>'
- culprit = get_culprit([{
- }])
- self.assertEquals(culprit, '<unknown>.<unknown>')
+class GetStackInfoTest(TestCase):
def test_bad_locals_in_frame(self):
frame = Mock()
frame.f_locals = Context({