@@ -192,14 +192,16 @@ def x():
192
192
self .assertEquals (res , 'tests.tests.x' )
193
193
194
194
def test_lambda (self ):
195
- res = get_name_from_obj (lambda :1 )
195
+ res = get_name_from_obj (lambda : 1 )
196
196
self .assertEquals (res , 'tests.tests.<lambda>' )
197
197
198
198
def test_class (self ):
199
- class A : pass
199
+ class A :
200
+ pass
200
201
res = get_name_from_obj (A )
201
202
self .assertEquals (res , 'tests.tests.A' )
202
203
204
+
203
205
class SQLPanelTestCase (BaseTestCase ):
204
206
def test_recording (self ):
205
207
panel = self .toolbar .get_panel (SQLDebugPanel )
@@ -222,7 +224,7 @@ def test_disable_stacktraces(self):
222
224
panel = self .toolbar .get_panel (SQLDebugPanel )
223
225
self .assertEquals (len (panel ._queries ), 0 )
224
226
225
- with Settings (DEBUG_TOOLBAR_CONFIG = { 'ENABLE_STACKTRACES' : False }):
227
+ with Settings (DEBUG_TOOLBAR_CONFIG = {'ENABLE_STACKTRACES' : False }):
226
228
list (User .objects .all ())
227
229
228
230
# ensure query was logged
@@ -242,19 +244,25 @@ def test_queryset_hook(self):
242
244
template_panel = self .toolbar .get_panel (TemplateDebugPanel )
243
245
sql_panel = self .toolbar .get_panel (SQLDebugPanel )
244
246
t = Template ("No context variables here!" )
245
- c = Context ({ 'queryset' : User .objects .all (), 'deep_queryset' : { 'queryset' : User .objects .all () } })
247
+ c = Context ({
248
+ 'queryset' : User .objects .all (),
249
+ 'deep_queryset' : {
250
+ 'queryset' : User .objects .all (),
251
+ }
252
+ })
246
253
t .render (c )
247
254
# ensure the query was NOT logged
248
255
self .assertEquals (len (sql_panel ._queries ), 0 )
249
256
ctx = template_panel .templates [0 ]['context' ][0 ]
250
- ctx = eval ( ctx ) # convert back to Python
251
- self .assertEquals ( ctx [ 'queryset' ], '<<queryset of auth.User >>' )
252
- self . assertEquals ( ctx [ 'deep_queryset' ], '<<triggers database query>>' )
257
+ self . assertIn ( '<<queryset of auth.User>>' , ctx )
258
+ self .assertIn ( '<<triggers database query >>', ctx )
259
+
253
260
254
261
def module_func (* args , ** kwargs ):
255
262
"""Used by dispatch tests"""
256
263
return 'blah'
257
264
265
+
258
266
class TrackingTestCase (BaseTestCase ):
259
267
@classmethod
260
268
def class_method (cls , * args , ** kwargs ):
0 commit comments