MCPcopy Index your code
hub / github.com/python/cpython / test_bug1175396

Method test_bug1175396

Lib/test/test_codecs.py:266–333  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

264 self.assertEqual(f.read(), '')
265
266 def test_bug1175396(self):
267 s = [
268 '<%!--===================================================\r\n',
269 ' BLOG index page: show recent articles,\r\n',
270 ' today\'s articles, or articles of a specific date.\r\n&#x27;,
271 '========================================================--%>\r\n',
272 '<%@inputencoding="ISO-8859-1"%>\r\n',
273 '<%@pagetemplate=TEMPLATE.y%>\r\n',
274 '<%@import=import frog.util, frog%>\r\n',
275 '<%@import=import frog.objects%>\r\n',
276 '<%@import=from frog.storageerrors import StorageError%>\r\n',
277 '<%\r\n',
278 '\r\n',
279 'import logging\r\n',
280 'log=logging.getLogger("Snakelets.logger")\r\n',
281 '\r\n',
282 '\r\n',
283 'user=self.SessionCtx.user\r\n',
284 'storageEngine=self.SessionCtx.storageEngine\r\n',
285 '\r\n',
286 '\r\n',
287 'def readArticlesFromDate(date, count=None):\r\n',
288 ' entryids=storageEngine.listBlogEntries(date)\r\n',
289 ' entryids.reverse() # descending\r\n',
290 ' if count:\r\n',
291 ' entryids=entryids[:count]\r\n',
292 ' try:\r\n',
293 ' return [ frog.objects.BlogEntry.load(storageEngine, date, Id) for Id in entryids ]\r\n',
294 ' except StorageError,x:\r\n',
295 ' log.error("Error loading articles: "+str(x))\r\n',
296 ' self.abort("cannot load articles")\r\n',
297 '\r\n',
298 'showdate=None\r\n',
299 '\r\n',
300 'arg=self.Request.getArg()\r\n',
301 'if arg=="today":\r\n',
302 ' #-------------------- TODAY\'S ARTICLES\r\n&#x27;,
303 ' self.write("<h2>Today\'s articles</h2>")\r\n&#x27;,
304 ' showdate = frog.util.isodatestr() \r\n',
305 ' entries = readArticlesFromDate(showdate)\r\n',
306 'elif arg=="active":\r\n',
307 ' #-------------------- ACTIVE ARTICLES redirect\r\n',
308 ' self.Yredirect("active.y")\r\n',
309 'elif arg=="login":\r\n',
310 ' #-------------------- LOGIN PAGE redirect\r\n',
311 ' self.Yredirect("login.y")\r\n',
312 'elif arg=="date":\r\n',
313 ' #-------------------- ARTICLES OF A SPECIFIC DATE\r\n',
314 ' showdate = self.Request.getParameter("date")\r\n',
315 ' self.write("<h2>Articles written on %s</h2>"% frog.util.mediumdatestr(showdate))\r\n',
316 ' entries = readArticlesFromDate(showdate)\r\n',
317 'else:\r\n',
318 ' #-------------------- RECENT ARTICLES\r\n',
319 ' self.write("<h2>Recent articles</h2>")\r\n',
320 ' dates=storageEngine.listBlogEntryDates()\r\n',
321 ' if dates:\r\n',
322 ' entries=[]\r\n',
323 ' SHOWAMOUNT=10\r\n',

Callers

nothing calls this directly

Calls 5

enumerateFunction · 0.85
getreaderMethod · 0.80
encodeMethod · 0.45
joinMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected