Mercurial > p > roundup > code
comparison test/test_templating.py @ 5378:35ea9b1efc14
Python 3 preparation: "raise" syntax.
Changing "raise Exception, value" to "raise Exception(value)".
Tool-assisted patch. Particular cases to check carefully are the one
place in frontends/ZRoundup/ZRoundup.py where a string exception
needed to be fixed, and the one in roundup/cgi/client.py involving
raising an exception with a traceback (requires three-argument form of
raise in Python 2, which as I understand it requires exec() to avoid a
Python 3 syntax error).
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Tue, 24 Jul 2018 21:39:58 +0000 |
| parents | 64b05e24dbd8 |
| children | d26921b851c3 |
comparison
equal
deleted
inserted
replaced
| 5377:12fe83f90f0d | 5378:35ea9b1efc14 |
|---|---|
| 70 db = HTMLDatabase(self.client) | 70 db = HTMLDatabase(self.client) |
| 71 def lookup(key): | 71 def lookup(key): |
| 72 if key == 'ok': | 72 if key == 'ok': |
| 73 return '1' | 73 return '1' |
| 74 if key == 'fail': | 74 if key == 'fail': |
| 75 raise KeyError, 'fail' | 75 raise KeyError('fail') |
| 76 return key | 76 return key |
| 77 db._db.classes = {'issue': MockNull(lookup=lookup)} | 77 db._db.classes = {'issue': MockNull(lookup=lookup)} |
| 78 prop = MockNull(classname='issue') | 78 prop = MockNull(classname='issue') |
| 79 self.assertEqual(lookupIds(db._db, prop, ['1','2']), ['1','2']) | 79 self.assertEqual(lookupIds(db._db, prop, ['1','2']), ['1','2']) |
| 80 self.assertEqual(lookupIds(db._db, prop, ['ok','2']), ['1','2']) | 80 self.assertEqual(lookupIds(db._db, prop, ['ok','2']), ['1','2']) |
