aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_utils.py
diff options
context:
space:
mode:
authorAymeric Augustin2013-11-01 21:51:37 +0100
committerAymeric Augustin2013-11-01 21:51:37 +0100
commit96f1cb4b0d4b10903502e917ddaa460bc05f5ca3 (patch)
tree2d72e912b523f498f7e1c82aad362d5e6a58f396 /tests/test_utils.py
parentf69f51f7abf25aaf5282c953475e8975694f41c1 (diff)
downloaddjango-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.py24
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')