comparison test/test_templating.py @ 5376:64b05e24dbd8

Python 3 preparation: convert print to a function. Tool-assisted patch. It is possible that some "from __future__ import print_function" are not in fact needed, if a file only uses print() with a single string as an argument and so would work fine in Python 2 without that import.
author Joseph Myers <jsm@polyomino.org.uk>
date Tue, 24 Jul 2018 09:54:52 +0000
parents 578e86e015f9
children 35ea9b1efc14
comparison
equal deleted inserted replaced
5375:1ad46057ae4a 5376:64b05e24dbd8
1 from __future__ import print_function
1 import unittest 2 import unittest
2 from cgi import FieldStorage, MiniFieldStorage 3 from cgi import FieldStorage, MiniFieldStorage
3 4
4 from roundup.cgi.templating import * 5 from roundup.cgi.templating import *
5 from test_actions import MockNull, true 6 from test_actions import MockNull, true
146 week_seconds = 604800 147 week_seconds = 604800
147 148
148 otks=self.client.db.getOTKManager() 149 otks=self.client.db.getOTKManager()
149 150
150 for test in [ 'module', 'template', 'default_time' ]: 151 for test in [ 'module', 'template', 'default_time' ]:
151 print "Testing:", test 152 print("Testing:", test)
152 153
153 if test == 'module': 154 if test == 'module':
154 # test the module function 155 # test the module function
155 nonce1 = anti_csrf_nonce(self, self.client, lifetime=1) 156 nonce1 = anti_csrf_nonce(self, self.client, lifetime=1)
156 # lifetime * 60 is the offset 157 # lifetime * 60 is the offset
175 self.assertEqual(uid, 10) 176 self.assertEqual(uid, 10)
176 self.assertEqual(sid, self.client.session_api._sid) 177 self.assertEqual(sid, self.client.session_api._sid)
177 178
178 now = time.time() 179 now = time.time()
179 180
180 print "now, timestamp, greater, difference", \ 181 print("now, timestamp, greater, difference",
181 now, timestamp, greater_than, now - timestamp 182 now, timestamp, greater_than, now - timestamp)
182 183
183 184
184 # lower bound of the difference is above. Upper bound 185 # lower bound of the difference is above. Upper bound
185 # of difference is run time between time.time() in 186 # of difference is run time between time.time() in
186 # the call to anti_csrf_nonce and the time.time() call 187 # the call to anti_csrf_nonce and the time.time() call

Roundup Issue Tracker: http://roundup-tracker.org/