【问题标题】:Test Commands are not recognised in Django测试命令在 Django 中不被识别
【发布时间】:2015-10-28 11:37:43
【问题描述】:

我在 Docker 容器中运行 Django 测试并使用 manage.py 运行我的测试。我的测试文件从django.test 导入TestCase,但由于某些原因,无法识别像AssertEqual 这样的命令:

AttributeError: 'TestSession' object has no attribute 'AssertEqual'

我做错了什么?

【问题讨论】:

    标签: django docker


    【解决方案1】:

    命令是assertEqual(注意断言中的小写'a'),而不是AssertEqual

    【讨论】:

    • 你说得对,我对 python 和 django 语法感到困惑
    • 很高兴它解决了您的问题,但我不确定您的意思 - Django 语法与 Python 相同;)
    猜你喜欢
    • 1970-01-01
    • 2011-10-26
    • 1970-01-01
    • 2015-02-22
    • 1970-01-01
    • 1970-01-01
    • 2018-12-29
    • 2015-05-09
    • 2020-01-13
    相关资源
    最近更新 更多