From 96f1cb4b0d4b10903502e917ddaa460bc05f5ca3 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Fri, 1 Nov 2013 21:51:37 +0100 Subject: Split tests across several modules. Fix #426. --- tests/test_utils.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/test_utils.py (limited to 'tests/test_utils.py') 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.') + + def test_class(self): + class A: + pass + res = get_name_from_obj(A) + self.assertEqual(res, 'tests.test_utils.A') -- cgit v1.2.3