質問編集履歴
2
コードの改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,29 +22,11 @@
|
|
22
22
|
|
23
23
|
### 発生している問題・エラーメッセージ
|
24
24
|
|
25
|
-
|
25
|
+
```ここに言語を入力
|
26
26
|
|
27
27
|
(trouble1) C:\Users\gdans\Desktop\trouble8_apptest\trouble8\tests>pytest test_urls_class_NG.py -v
|
28
28
|
|
29
|
-
=============================================================================================== test session starts ===============================================================================================
|
30
29
|
|
31
|
-
platform win32 -- Python 3.7.7, pytest-5.4.3, py-1.9.0, pluggy-0.13.1 -- c:\users\gdans\anaconda3\envs\trouble1\python.exe
|
32
|
-
|
33
|
-
cachedir: .pytest_cache
|
34
|
-
|
35
|
-
rootdir: C:\Users\gdans\Desktop\trouble8_apptest\trouble8\tests
|
36
|
-
|
37
|
-
plugins: django-3.9.0
|
38
|
-
|
39
|
-
collected 1 item
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
test_urls_class_NG.py::test_url_find ERROR [100%]
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
===================================================================================================== ERRORS ======================================================================================================
|
48
30
|
|
49
31
|
_________________________________________________________________________________________ ERROR at setup of test_url_find _________________________________________________________________________________________
|
50
32
|
|
@@ -62,11 +44,9 @@
|
|
62
44
|
|
63
45
|
C:\Users\gdans\Desktop\trouble8_apptest\trouble8\tests\test_urls_class_NG.py:11
|
64
46
|
|
65
|
-
============================================================================================= short test summary info =============================================================================================
|
66
47
|
|
67
|
-
ERROR test_urls_class_NG.py::test_url_find
|
68
48
|
|
69
|
-
|
49
|
+
```
|
70
50
|
|
71
51
|
|
72
52
|
|
@@ -76,15 +56,17 @@
|
|
76
56
|
|
77
57
|
◆①テスト対象コード:find.py
|
78
58
|
|
59
|
+
```ここに言語を入力
|
60
|
+
|
79
61
|
from django.shortcuts import render
|
80
62
|
|
81
63
|
from django.views.generic import TemplateView
|
82
64
|
|
83
65
|
|
84
66
|
|
85
|
-
class FindResultView(TemplateView): ★①
|
67
|
+
**class FindResultView(TemplateView): ★①
|
86
68
|
|
87
|
-
def __init__(self): ★②
|
69
|
+
def __init__(self): ★②**
|
88
70
|
|
89
71
|
title = 'title test'
|
90
72
|
|
@@ -94,13 +76,17 @@
|
|
94
76
|
|
95
77
|
}
|
96
78
|
|
97
|
-
def get(request, self): ★③
|
79
|
+
** def get(request, self): ★③**
|
98
80
|
|
99
81
|
return render(request, 'find.html', self.params)
|
82
|
+
|
83
|
+
```
|
100
84
|
|
101
85
|
|
102
86
|
|
103
87
|
◆②テスト対象コード:urls.py
|
88
|
+
|
89
|
+
```ここに言語を入力
|
104
90
|
|
105
91
|
from django.urls import path
|
106
92
|
|
@@ -114,11 +100,13 @@
|
|
114
100
|
|
115
101
|
]
|
116
102
|
|
103
|
+
```
|
104
|
+
|
117
105
|
|
118
106
|
|
119
107
|
◆③テストコード:test_urls_class.py
|
120
108
|
|
121
|
-
|
109
|
+
```ここに言語を入力
|
122
110
|
|
123
111
|
import os
|
124
112
|
|
@@ -136,13 +124,15 @@
|
|
136
124
|
|
137
125
|
|
138
126
|
|
139
|
-
def test_url_find(self, request): ★④
|
127
|
+
**def test_url_find(self, request): ★④
|
140
128
|
|
141
|
-
f = FindResultView(self, request) ★④
|
129
|
+
f = FindResultView(self, request) ★④**
|
142
130
|
|
143
131
|
found = resolve('/trouble8/find')
|
144
132
|
|
145
133
|
assert found.func == f
|
134
|
+
|
135
|
+
```
|
146
136
|
|
147
137
|
|
148
138
|
|
1
タイトルの改善
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
【Django】urls
|
1
|
+
【Django】urlsテスト:fixture 'self' not foundエラー
|
test
CHANGED
File without changes
|