diff options
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') | 
