我正在尝试为re_path
url编写一个测试,但我无法理解它。下面是到目前为止我的代码。请原谅当天的批评和评论。我不知道如何逃脱这个不到的符号
urls.py
文件:
from django.urls import path, re_path
from . import views
urlpatterns = [
re_path(r'trophy/(?P<userid>\w+)/(?P<comment_of_the_day>\w+)/$', views.commentoftheday, name='commentoftheday'),
]
tests.py
文件:
from django.test import TestCase, Client
from django.urls import reverse
class helpme(TestCase):
def test1(self):
response = self.client.get(reverse("commentoftheday"), kwargs={'userid':'bleh'})
response.status_code
目前没有回答
相关问题 更多 >
编程相关推荐