Mercurial > p > roundup > code
comparison test/test_actions.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 | 198b6e810c67 |
| 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 import hyperdb | 5 from roundup import hyperdb |
| 5 from roundup.date import Date, Interval | 6 from roundup.date import Date, Interval |
| 150 self.form.value.append(MiniFieldStorage('foo', 'hello')) | 151 self.form.value.append(MiniFieldStorage('foo', 'hello')) |
| 151 self.assertFilterEquals('foo') | 152 self.assertFilterEquals('foo') |
| 152 | 153 |
| 153 def testNumKey(self): # testing patch: http://hg.python.org/tracker/roundup/rev/98508a47c126 | 154 def testNumKey(self): # testing patch: http://hg.python.org/tracker/roundup/rev/98508a47c126 |
| 154 for val in [ "-1000a", "test", "o0.9999", "o0", "1.00/10" ]: | 155 for val in [ "-1000a", "test", "o0.9999", "o0", "1.00/10" ]: |
| 155 print "testing ", val | 156 print("testing ", val) |
| 156 self.client.db.classes.get_transitive_prop = lambda x: hyperdb.Number() | 157 self.client.db.classes.get_transitive_prop = lambda x: hyperdb.Number() |
| 157 self.form.value.append(MiniFieldStorage('foo', val)) # invalid numbers | 158 self.form.value.append(MiniFieldStorage('foo', val)) # invalid numbers |
| 158 self.assertRaises(FormError, self.action.fakeFilterVars) | 159 self.assertRaises(FormError, self.action.fakeFilterVars) |
| 159 del self.form.value[:] | 160 del self.form.value[:] |
| 160 | 161 |
| 164 self.action.fakeFilterVars() # this should run and return. No errors, nothing to check. | 165 self.action.fakeFilterVars() # this should run and return. No errors, nothing to check. |
| 165 del self.form.value[:] | 166 del self.form.value[:] |
| 166 | 167 |
| 167 def testIntKey(self): # testing patch: http://hg.python.org/tracker/roundup/rev/98508a47c126 | 168 def testIntKey(self): # testing patch: http://hg.python.org/tracker/roundup/rev/98508a47c126 |
| 168 for val in [ "-1000a", "test", "-5E-5", "0.9999", "0.0", "1.000", "0456", "1E4" ]: | 169 for val in [ "-1000a", "test", "-5E-5", "0.9999", "0.0", "1.000", "0456", "1E4" ]: |
| 169 print "testing ", val | 170 print("testing ", val) |
| 170 self.client.db.classes.get_transitive_prop = lambda x: hyperdb.Integer() | 171 self.client.db.classes.get_transitive_prop = lambda x: hyperdb.Integer() |
| 171 self.form.value.append(MiniFieldStorage('foo', val)) | 172 self.form.value.append(MiniFieldStorage('foo', val)) |
| 172 self.assertRaises(FormError, self.action.fakeFilterVars) | 173 self.assertRaises(FormError, self.action.fakeFilterVars) |
| 173 del self.form.value[:] | 174 del self.form.value[:] |
| 174 | 175 |
