所有测试都完成没有错误,实际加载了固定装置.是Django 1.4问题吗?
请注意,只有部分应用程序会引发此错误消息(应用程序的单元测试与其相应的夹具之间没有概念上的区别).
更新1:在fasttest.py内容:
DATABASES = {'default':
{
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
~/django_project$ ./manage.py test appname --traceback --settings=fasttest
Creating test database for alias 'default'...
.....................No database fixture specified. Please provide the path of at least one fixture in the command line.
.
----------------------------------------------------------------------
Ran 22 tests in 8.426s
OK
Destroying test database for alias 'default'...
Run Code Online (Sandbox Code Playgroud)
更新2:显然评论虽然我感谢尝试,但只是在黑暗中拍摄.数据库没关系,SQLite3和Postgres测试DB都没有解决问题.
node -e 'console.log(- -1)' // prints 1 which makes sense
Run Code Online (Sandbox Code Playgroud)
然而:
node -e 'console.log(1 - - 1)' // prints 2 which does not make sense to me
Run Code Online (Sandbox Code Playgroud)
integer - - integer神奇地将"减号,空格,减号"转换为"加号"运算符.为什么?
更新:似乎我不够清楚.问题不是为什么,double negative in mathematics will always evaluate to a positive而是如何神奇地评估+运营商; 这是两种不同的情况 - 使负数正是一回事,隐含地调用+是另一回事.
[1,2,4,8][0,1,2,3]
// equals to 8 (the last element of the indexing array (3) becomes the index)
Run Code Online (Sandbox Code Playgroud)
为什么这不是SyntaxError错误(糟糕的遗产或有目的的功能)?(可能重复,但我无法在这里找到答案。)
更新:为什么the contents of the square brackets are treated as an expression?