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. 在linux命令行中直接执行php命令

    有时候用浏览器调试太麻烦,想在linux命令下直接执行php代码 php -r 'echo 0500;'

  2. 使用MVVM框架(avalonJS)进行快速开发

    背景 在运营活动开发中,因为工作的重复性很大,同时往往开发时间短,某些情况下也会非常紧急,导致了活动开发时间被大大压缩,同时有些活动逻辑复杂,数据或者状态变更都需要手动渲染,容易出错,正是因为这些问题 ...

  3. Maven初级学习(二)Maven使用入门

    序,学习配置pom.xml,利用maven生成eclipes项目. 一.编写POM POM Project Obejct Model,项目对象模型. 编写pom.xml,新建文件夹hello-worl ...

  4. cf251.2.C (构造题的技巧)

    C. Devu and Partitioning of the Array time limit per test 1 second memory limit per test 256 megabyt ...

  5. Window环境下搭建MyEclipse+Tomcat+MAVEN+SVN

    1.JDK的安装 首先下载JDK,这个从sun公司官网(http://www.oracle.com/)可以下载,根据自己的系统选择64位还是32位,安装过程就是next一路到底.安装完成之后当然要配置 ...

  6. tone mapping简介

    以下内容转自网络: tone Mapping原是摄影学中的一个术语,因为打印相片所能表现的亮度范围不足以表现现实世界中的亮度域,而如果简单的将真实世界的整个亮度域线性压缩到照片所能表现的亮度域内,则会 ...

  7. js 区分数据类型

    这是第二版,可以区分 1.基本数据类型(string.number.boolean) undefined.null 2.引用类型 数组.RegExp.函数. 自定义数据类型(通过new 函数名得到) ...

  8. DEV控件Grid显示行号

    DEV控件Grid的显示行号需要通过一个事件来设置,具体设置代码为: private void gridView1_CustomDrawRowIndicator(object sender, DevE ...

  9. An error in projects

    Error能使系统产生Failure从而导致系统不能达到所需的功能. 曾经,做一个关于酒店管理系统的项目.因为数据库表主外键的连接错误,当对页面的添加桌位功能进行测试时,不能正确的添加. 后通过逐行对 ...

  10. NGUI Sprite 和 Label 改变Layer 或父物体后 未更新深度问题

    using UnityEngine; using System.Collections.Generic; /// <summary> /// Sprite is a textured el ...