Mercurial > p > roundup > code
comparison test/db_test_base.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 | c5e72a3c69dd |
| children | 0942fe89e82e |
comparison
equal
deleted
inserted
replaced
| 5375:1ad46057ae4a | 5376:64b05e24dbd8 |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 | 17 |
| 18 from __future__ import print_function | |
| 18 import unittest, os, shutil, errno, imp, sys, time, pprint, base64, os.path | 19 import unittest, os, shutil, errno, imp, sys, time, pprint, base64, os.path |
| 19 import logging, cgi | 20 import logging, cgi |
| 20 import gpgmelib | 21 import gpgmelib |
| 21 from email.parser import FeedParser | 22 from email.parser import FeedParser |
| 22 | 23 |
| 1046 result=self.db.issue.generateCreateNote(new_issue) | 1047 result=self.db.issue.generateCreateNote(new_issue) |
| 1047 self.assertEqual(result, '\n----------\ntitle: title2') | 1048 self.assertEqual(result, '\n----------\ntitle: title2') |
| 1048 | 1049 |
| 1049 # check history including quiet properties | 1050 # check history including quiet properties |
| 1050 result=self.db.issue.history(new_issue, skipquiet=False) | 1051 result=self.db.issue.history(new_issue, skipquiet=False) |
| 1051 print result | 1052 print(result) |
| 1052 ''' output should be like: | 1053 ''' output should be like: |
| 1053 [ ... ('1', <Date 2017-04-14.01:41:08.466>, '1', 'set', | 1054 [ ... ('1', <Date 2017-04-14.01:41:08.466>, '1', 'set', |
| 1054 {'assignedto': None, 'nosy': (('+', ['3', '2']),), | 1055 {'assignedto': None, 'nosy': (('+', ['3', '2']),), |
| 1055 'deadline': <Date 2016-06-30.22:39:00.000>, | 1056 'deadline': <Date 2016-06-30.22:39:00.000>, |
| 1056 'title': 'title'}) | 1057 'title': 'title'}) |
| 1059 'nosy': (('+', ['3', '2']),), | 1060 'nosy': (('+', ['3', '2']),), |
| 1060 'deadline': date.Date('2016-06-30.22:39'), | 1061 'deadline': date.Date('2016-06-30.22:39'), |
| 1061 'title': 'title'} | 1062 'title': 'title'} |
| 1062 | 1063 |
| 1063 result.sort() | 1064 result.sort() |
| 1064 print "history include quiet props", result[-1] | 1065 print("history include quiet props", result[-1]) |
| 1065 (id, tx_date, user, action, args) = result[-1] | 1066 (id, tx_date, user, action, args) = result[-1] |
| 1066 # check piecewise ignoring date of transaction | 1067 # check piecewise ignoring date of transaction |
| 1067 self.assertEqual('1', id) | 1068 self.assertEqual('1', id) |
| 1068 self.assertEqual('1', user) | 1069 self.assertEqual('1', user) |
| 1069 self.assertEqual('set', action) | 1070 self.assertEqual('set', action) |
| 1076 {'title': 'title'}) | 1077 {'title': 'title'}) |
| 1077 ''' | 1078 ''' |
| 1078 expected = {'title': 'title'} | 1079 expected = {'title': 'title'} |
| 1079 | 1080 |
| 1080 result.sort() | 1081 result.sort() |
| 1081 print "history remove quiet props", result[-1] | 1082 print("history remove quiet props", result[-1]) |
| 1082 (id, tx_date, user, action, args) = result[-1] | 1083 (id, tx_date, user, action, args) = result[-1] |
| 1083 # check piecewise | 1084 # check piecewise |
| 1084 self.assertEqual('1', id) | 1085 self.assertEqual('1', id) |
| 1085 self.assertEqual('1', user) | 1086 self.assertEqual('1', user) |
| 1086 self.assertEqual('set', action) | 1087 self.assertEqual('set', action) |
| 1110 result=self.db.issue.history(new_issue) | 1111 result=self.db.issue.history(new_issue) |
| 1111 expected = {'nosy': (('+', ['1']), ('-', ['3'])), | 1112 expected = {'nosy': (('+', ['1']), ('-', ['3'])), |
| 1112 'deadline': date.Date("2016-07-30.22:39:00.000")} | 1113 'deadline': date.Date("2016-07-30.22:39:00.000")} |
| 1113 | 1114 |
| 1114 result.sort() | 1115 result.sort() |
| 1115 print "result unquiet", result | 1116 print("result unquiet", result) |
| 1116 (id, tx_date, user, action, args) = result[-1] | 1117 (id, tx_date, user, action, args) = result[-1] |
| 1117 # check piecewise | 1118 # check piecewise |
| 1118 self.assertEqual('1', id) | 1119 self.assertEqual('1', id) |
| 1119 self.assertEqual('1', user) | 1120 self.assertEqual('1', user) |
| 1120 self.assertEqual('set', action) | 1121 self.assertEqual('set', action) |
| 3376 # Note that in the template above, the rendering of the | 3377 # Note that in the template above, the rendering of the |
| 3377 # context/submit button will also call anti_csrf_nonce which | 3378 # context/submit button will also call anti_csrf_nonce which |
| 3378 # does a commit of the otk to the database. | 3379 # does a commit of the otk to the database. |
| 3379 cl.inner_main() | 3380 cl.inner_main() |
| 3380 cl.db.close() | 3381 cl.db.close() |
| 3381 print self.out | 3382 print(self.out) |
| 3382 # Make sure the action was called | 3383 # Make sure the action was called |
| 3383 self.assertEqual(SpecialAction.x, True) | 3384 self.assertEqual(SpecialAction.x, True) |
| 3384 # Check that the Reject worked: | 3385 # Check that the Reject worked: |
| 3385 self.assertNotEqual(-1, self.out[0].index('REJECT TITLE CHANGE')) | 3386 self.assertNotEqual(-1, self.out[0].index('REJECT TITLE CHANGE')) |
| 3386 # Re-open db | 3387 # Re-open db |
