def xx():

冒号下一行要缩进

ATD

http://blog.csdn.net/doupei2006/article/details/7657547

http://www.jb51.net/article/64633.htm

>>> import datetime
>>> from django.utils import timezone
>>> from polls.models import Question
>>> # create a Question instance with pub_date 30 days in the future
>>> future_question = Question(pub_date=timezone.now() + datetime.timedelta(days=30))
>>> # was it published recently?
>>> future_question.was_published_recently()
True

tests.py

class QuestionMethodTest(TestCase):

    def test_was_published_recently_with_future_question(self):
#was_published_recently()should return False for questions whose
#pub_date is in the future
time=timezone.now()+datetime.timedelta(days=30)
future_question=Question(pub_date=time)
self.assertEqual(future_question.was_published_recently(),False)

if def for :::

Django~automated tests的更多相关文章

  1. iOS Automated Tests with UIAutomation

    参照:http://blog.manbolo.com/2012/04/08/ios-automated-tests-with-uiautomation#1 UI Automation JavaScri ...

  2. 【翻译】Django Channels 官方文档 -- Tutorial

    Django Channels 官方文档 https://channels.readthedocs.io/en/latest/index.html 前言: 最近课程设计需要用到 WebSocket,而 ...

  3. [ZZ]Android UI Automated Testing

    Google Testing Blog最近发表了一篇Android UI Automated Testing,我把他转载过来,墙外地址:http://googletesting.blogspot.co ...

  4. How to: Run Tests from Microsoft Visual Studio

    https://msdn.microsoft.com/en-us/library/ms182470.aspx Running Automated Tests in Visual Studio Visu ...

  5. C# Note37: Writing unit tests with use of mocking

    前言 What's mocking and its benefits Mocking is an integral part of unit testing. Although you can run ...

  6. Django 2.0.1 官方文档翻译:编写你的第一个djang补丁(page 15)

    编写你的第一个djang补丁(page 15) 介绍 有兴趣为社区做一些贡献?可能你发现了django中的一个你想修复的bug,或者你你想添加一个小小的功能. 回馈django就是解决你遇到的问题的最 ...

  7. Django——test文件编写接口测试

    用自己建立的小网页来做接口测试,在Django的tests.py写下如下 test_login_page为用get方式登录login路径,根据回复验证是否查看到页面 test_login_action ...

  8. 【转】Automated Testing Detail Test Plan

    Automated Testing Detail Test PlanAutomated Testing DTP Overview This Automated Testing Detail Test ...

  9. [Test] Easy automated testing in NodeJS with TestCafe

    Quickly get up and running with sensible automated testing scenarios written in ES6. Installing and ...

随机推荐

  1. jquery 获取和设置 checkbox radio 和 select option的值?

    ============== 获取和设置 checkbox radio 和 select的值? === val()函数, 其名字就表达了 它的意思: 他就是= value 的简写! val就是valu ...

  2. vim查找替换

    http://www.cnblogs.com/ltang/articles/2034291.html %: 表示百分百,表示所有 行的意思... 如果不指定行号, 则表示当前行; g: 表示一行中的所 ...

  3. (准备写)URAL1824 Ifrit Bomber 题解

    http://acm.timus.ru/problem.aspx?space=1&num=1824 1824. Ifrit Bomber Time limit: 0.5 second Memo ...

  4. LYDSY模拟赛day9 2048

    /* 大模拟题,做的时候思路还是比较清晰的 */ #include<iostream> #include<cstdio> #include<string> #inc ...

  5. 今天<s:hidden>突然能用了

    曾经好几个作业中都想要用<s:hidden>隐形传值,一直没有成功. 今天放弃使用了,竟然成功了. 我放弃使用居然成功了,原来只要设置好getter和setter之后就不用管了,只要变量名 ...

  6. Codeforces 271 Div 2 B. Worms

    题目链接:http://codeforces.com/contest/474/problem/B 解题报告:给你n个堆,第i个堆有ai个物品,物品的编号从1开始,第一堆的编号从1到a1,第二堆编号从a ...

  7. eclipse pydev 跳转

    [windows]-[Preference]-[Pydev]-[Interpreter-Python]-[Libraries]-system PYTHONPATH 全部加一遍,先加父目录,再加子目录.

  8. JQGrid 参数、属性API

    JQGrid是一个在jquery基础上做的一个表格控件,以ajax的方式和服务器端通信. JQGrid Demo 是一个在线的演示项目.在这里,可以知道jqgrid可以做什么事情. 下面是转自其他人b ...

  9. uploadify插件的功能应用

    一.相关key值介绍 uploader:uploadify.swf文件的相对路径,该swf文件是一个带有文字BROWSE的按钮,点击后淡出打开文件对话框,默认值:uploadify.swf. scri ...

  10. String,StringBuffer,StringBuilder区别

    String 字符串常量StringBuffer 字符串变量(线程安全)StringBuilder 字符串变量(非线程安全) 简要的说, String 类型和 StringBuffer 类型的主要性能 ...