Attribute access to `url` incorrectly replaced
browniebroke opened this issue · comments
Bruno Alla commented
Describe the bug
Issue with URL Transformer, converting an attribute access of the HttpResponseRedirectBase.url
to HttpResponseRedirectBase.re_path
if django.conf.urls.url
is imported
To Reproduce
Consider this code (from a test case):
from django.conf.urls import url
# Define some URL patterns for tests
urlpatterns = [
url(r'^something', Mock(), name='something'),
]
# Later:
assert isinstance(response, HttpResponseRedirectBase)
assert response.url == expected_path
The last assertion is incorrectly converted to:
assert response.re_path == expected_path
Additional context
This is potentially affecting other rename transformers.