diff options
| author | Jannis Leidel | 2012-05-13 12:52:38 +0200 |
|---|---|---|
| committer | Jannis Leidel | 2012-05-13 12:52:38 +0200 |
| commit | f99833a5eb6302bcb62f593cc5483abc9fe0c9fe (patch) | |
| tree | b0cd2d101cb7ed5409df7243061c898f21a23c91 | |
| parent | 676eebd9600eb938804b652ce572a30e3ee6626e (diff) | |
| download | django-debug-toolbar-f99833a5eb6302bcb62f593cc5483abc9fe0c9fe.tar.bz2 | |
Fixed a few cosmetic issues in the tests.
| -rw-r--r-- | tests/tests.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/tests.py b/tests/tests.py index 5a05050..32ea9d9 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -192,14 +192,16 @@ class DebugToolbarNameFromObjectTest(BaseTestCase): self.assertEquals(res, 'tests.tests.x') def test_lambda(self): - res = get_name_from_obj(lambda:1) + res = get_name_from_obj(lambda: 1) self.assertEquals(res, 'tests.tests.<lambda>') def test_class(self): - class A: pass + class A: + pass res = get_name_from_obj(A) self.assertEquals(res, 'tests.tests.A') + class SQLPanelTestCase(BaseTestCase): def test_recording(self): panel = self.toolbar.get_panel(SQLDebugPanel) @@ -222,7 +224,7 @@ class SQLPanelTestCase(BaseTestCase): panel = self.toolbar.get_panel(SQLDebugPanel) self.assertEquals(len(panel._queries), 0) - with Settings(DEBUG_TOOLBAR_CONFIG={ 'ENABLE_STACKTRACES' : False }): + with Settings(DEBUG_TOOLBAR_CONFIG={'ENABLE_STACKTRACES': False}): list(User.objects.all()) # ensure query was logged @@ -242,19 +244,25 @@ class TemplatePanelTestCase(BaseTestCase): template_panel = self.toolbar.get_panel(TemplateDebugPanel) sql_panel = self.toolbar.get_panel(SQLDebugPanel) t = Template("No context variables here!") - c = Context({ 'queryset' : User.objects.all(), 'deep_queryset' : { 'queryset' : User.objects.all() } }) + c = Context({ + 'queryset': User.objects.all(), + 'deep_queryset': { + 'queryset': User.objects.all(), + } + }) t.render(c) # ensure the query was NOT logged self.assertEquals(len(sql_panel._queries), 0) ctx = template_panel.templates[0]['context'][0] - ctx = eval(ctx) # convert back to Python - self.assertEquals(ctx['queryset'], '<<queryset of auth.User>>') - self.assertEquals(ctx['deep_queryset'], '<<triggers database query>>') + self.assertIn('<<queryset of auth.User>>', ctx) + self.assertIn('<<triggers database query>>', ctx) + def module_func(*args, **kwargs): """Used by dispatch tests""" return 'blah' + class TrackingTestCase(BaseTestCase): @classmethod def class_method(cls, *args, **kwargs): |
