diff options
| author | Aymeric Augustin | 2013-11-01 21:51:37 +0100 |
|---|---|---|
| committer | Aymeric Augustin | 2013-11-01 21:51:37 +0100 |
| commit | 96f1cb4b0d4b10903502e917ddaa460bc05f5ca3 (patch) | |
| tree | 2d72e912b523f498f7e1c82aad362d5e6a58f396 /tests/test_utils.py | |
| parent | f69f51f7abf25aaf5282c953475e8975694f41c1 (diff) | |
| download | django-debug-toolbar-96f1cb4b0d4b10903502e917ddaa460bc05f5ca3.tar.bz2 | |
Split tests across several modules.
Fix #426.
Diffstat (limited to 'tests/test_utils.py')
| -rw-r--r-- | tests/test_utils.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py new file mode 100644 index 0000000..a930894 --- /dev/null +++ b/tests/test_utils.py @@ -0,0 +1,24 @@ +from __future__ import unicode_literals + +from django.utils.unittest import TestCase + +from debug_toolbar.utils import get_name_from_obj + + +class GetNameFromObjTestCase(TestCase): + + def test_func(self): + def x(): + return 1 + res = get_name_from_obj(x) + self.assertEqual(res, 'tests.test_utils.x') + + def test_lambda(self): + res = get_name_from_obj(lambda: 1) + self.assertEqual(res, 'tests.test_utils.<lambda>') + + def test_class(self): + class A: + pass + res = get_name_from_obj(A) + self.assertEqual(res, 'tests.test_utils.A') |
