MCPcopy Index your code
hub / github.com/webpy/webpy / testUnload

Method testUnload

tests/test_application.py:348–377  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

346 )
347
348 def testUnload(self):
349 x = web.storage(a=0)
350
351 # fmt: off
352 urls = (
353 "/foo", "foo",
354 "/bar", "bar"
355 )
356 # fmt: on
357
358 class foo:
359 def GET(self):
360 return "foo"
361
362 class bar:
363 def GET(self):
364 raise web.notfound()
365
366 app = web.application(urls, locals())
367
368 def unload():
369 x.a += 1
370
371 app.add_processor(web.unloadhook(unload))
372
373 app.request("/foo")
374 self.assertEqual(x.a, 1)
375
376 app.request("/bar")
377 self.assertEqual(x.a, 2)
378
379 def test_changequery(self):
380 urls = ("/", "index")

Callers

nothing calls this directly

Calls 2

add_processorMethod · 0.80
requestMethod · 0.80

Tested by

no test coverage detected