diff options
| author | David Cramer <dcramer@gmail.com> | 2012-12-26 13:34:57 -0800 |
|---|---|---|
| committer | David Cramer <dcramer@gmail.com> | 2012-12-26 13:34:57 -0800 |
| commit | a4e19855e906117d0502993a9d54f94d9e4c9e95 (patch) | |
| tree | f6b7873dac7d5a022e0e0b0bee3452b9c60d92e6 /tests/utils | |
| parent | e2a56d9a20f6aa83b83a1ddc6ef4a7d71cc6debd (diff) | |
| download | raven-a4e19855e906117d0502993a9d54f94d9e4c9e95.tar.gz | |
Correct behavior of get_culprit and improve tests
Diffstat (limited to 'tests/utils')
| -rw-r--r-- | tests/utils/stacks/tests.py | 17 |
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({ |
