              "`list_route` is pending deprecation and will be removed in "
              "3.10 in favor of `action`, which accepts a `detail` bool. Use "
              "`@action(detail=False)` instead."
          )
 
</s> remove     return action(methods, detail=False, **kwargs)
 </s> add     def decorator(func):
        func = action(methods, detail=False, **kwargs)(func)
        if 'url_name' not in kwargs:
            func.url_name = func.url_path.replace('_', '-')
        return func
    return decorator </s> remove     return action(methods, detail=True, **kwargs)
 </s> add     def decorator(func):
        func = action(methods, detail=True, **kwargs)(func)
        if 'url_name' not in kwargs:
            func.url_name = func.url_path.replace('_', '-')
        return func
    return decorator </s> remove         func.url_path = url_path or func.__name__
        func.url_name = url_name or func.__name__.replace('_', '-')
 </s> add         func.url_path = url_path if url_path else func.__name__
        func.url_name = url_name if url_name else func.__name__.replace('_', '-')
    def test_route_url_name_from_path(self):
        # pre-3.8 behavior was to base the `url_name` off of the `url_path`
        with pytest.warns(PendingDeprecationWarning):
            @list_route(url_path='foo_bar')
            def view(request):
                pass

        assert view.url_path == 'foo_bar'
        assert view.url_name == 'foo-bar'
              "`list_route` is pending deprecation and will be removed in "
              "3.10 in favor of `action`, which accepts a `detail` bool. Use "
              "`@action(detail=False)` instead."
          )
    def test_route_url_name_from_path(self):
        # pre-3.8 behavior was to base the `url_name` off of the `url_path`
        with pytest.warns(PendingDeprecationWarning):
            @list_route(url_path='foo_bar')
            def view(request):
                pass

        assert view.url_path == 'foo_bar'
        assert view.url_name == 'foo-bar'
keep keep keep add
 Use old url_name behavior in route decorators (#5915)

* Wrap action decorator for old url_name behavior 
tests/test_decorators.py