MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_bug1175396

Method test_bug1175396

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

Source from the content-addressed store, hash-verified

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