How do I unit test django urls?
问题 I have achieved 100% test coverage in my application everywhere except my urls.py . Do you have any recommendations for how I could write meaningful unit tests for my URLs? FWIW This question has arisen as I am experimenting with Test-Driven Development and want failing tests before I write code to fix them. 回答1: One way would be to reverse URL names and validate Example urlpatterns = [ url(r'^archive/(\d{4})/$', archive, name="archive"), url(r'^archive-summary/(\d{4})/$', archive, name=