-
카테고리
-
세부 분야
풀스택
-
해결 여부
미해결
comment_000 'NoneType' 에러 질문드립니다...
20.10.20 16:03 작성 조회수 92
0
(venv) λ python manage.py test
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
.....E......
======================================================================
ERROR: test_post_detail (blog.tests.TestView)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\user\Desktop\django\github\django_my_website\blog\tests.py", line 254, in test_post_detail
self.assertIn(comment_000.author.username, comments_div.text)
AttributeError: 'NoneType' object has no attribute 'author'
----------------------------------------------------------------------
Ran 12 tests in 9.590s
FAILED (errors=1)
Destroying test database for alias 'default'...
깃헙에 있는 이번 test 복사해서 붙여넣기 했는데 이런 에러가 자꾸 나는데 머가 잘못된건가요?? 그 전까진 에러가 안나다가 왜 이러는지 궁금합니다! 감사합니다.. ㅜㅜ
답변을 작성해보세요.
0
장사업가
2021.02.28
저도 같은 문제 때문에 1시간 고생한거 같네요~ 혹시 (tests.py)에 정의되어 있는 def create_comment 리턴값을 빼먹은건 아니신지...
0
SungYong Lee
지식공유자2020.10.20
comment_000이 잘 정의되어 있는지 확인해보세요. 저 메시지는 comment_000이 정의되어 있지 않아서 None 인 상태라는 뜻입니다.
답변 2