Mercurial > p > roundup > code
comparison test/test_actions.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 |
|---|---|
| 43 else: | 43 else: |
| 44 if hasattr(exception, '__name__'): | 44 if hasattr(exception, '__name__'): |
| 45 excName = exception.__name__ | 45 excName = exception.__name__ |
| 46 else: | 46 else: |
| 47 excName = str(exception) | 47 excName = str(exception) |
| 48 raise self.failureException, excName | 48 raise self.failureException(excName) |
| 49 | 49 |
| 50 def testShowAction(self): | 50 def testShowAction(self): |
| 51 self.client.base = 'BASE/' | 51 self.client.base = 'BASE/' |
| 52 | 52 |
| 53 action = ShowAction(self.client) | 53 action = ShowAction(self.client) |
| 252 else: | 252 else: |
| 253 if hasattr(exception, '__name__'): | 253 if hasattr(exception, '__name__'): |
| 254 excName = exception.__name__ | 254 excName = exception.__name__ |
| 255 else: | 255 else: |
| 256 excName = str(exception) | 256 excName = str(exception) |
| 257 raise self.failureException, excName | 257 raise self.failureException(excName) |
| 258 | 258 |
| 259 def assertLoginLeavesMessages(self, messages, username=None, password=None): | 259 def assertLoginLeavesMessages(self, messages, username=None, password=None): |
| 260 if username is not None: | 260 if username is not None: |
| 261 self.form.value.append(MiniFieldStorage('__login_name', username)) | 261 self.form.value.append(MiniFieldStorage('__login_name', username)) |
| 262 if password is not None: | 262 if password is not None: |
