mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
Improved fix for #18373 -- backward compatibility
Commit 79558c78
cleaned up the (undocumented) interface of Resolver404
exception, which breaks compatibility with code messing with .args[0]
directly. Revert the cleanup part and simply leave the fix itself.
This commit is contained in:
parent
d0133504e5
commit
0b6f9f7c6f
3 changed files with 15 additions and 15 deletions
|
@ -272,10 +272,10 @@ class ResolverTests(unittest.TestCase):
|
|||
self.fail('resolve did not raise a 404')
|
||||
except Resolver404 as e:
|
||||
# make sure we at least matched the root ('/') url resolver:
|
||||
self.assertTrue(hasattr(e, 'tried'))
|
||||
tried = e.tried
|
||||
self.assertEqual(len(tried), len(url_types_names), 'Wrong number of tried URLs returned. Expected %s, got %s.' % (len(url_types_names), len(tried)))
|
||||
for tried, expected in zip(tried, url_types_names):
|
||||
self.assertTrue('tried' in e.args[0])
|
||||
tried = e.args[0]['tried']
|
||||
self.assertEqual(len(e.args[0]['tried']), len(url_types_names), 'Wrong number of tried URLs returned. Expected %s, got %s.' % (len(url_types_names), len(e.args[0]['tried'])))
|
||||
for tried, expected in zip(e.args[0]['tried'], url_types_names):
|
||||
for t, e in zip(tried, expected):
|
||||
self.assertIsInstance(t, e['type']), str('%s is not an instance of %s') % (t, e['type'])
|
||||
if 'name' in e:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue