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. shell脚本笔记(原创不断记录)

    今天开始自己的shell脚本练习,刚好公司有太服务器,要时间对数据的cp是按月的: 考虑:首先寻找规律,发现都放置在/opt/www/aaa/  里面有很多的2级和3级目录和文件,但我追踪要备份的是年 ...

  2. centos 安装 mysql5.7.9初始密码问题

    mysql5.7.9在安装完成后会,root用户会产生一个不为空的初始密码,登陆mysql就会产生问题了,有必要修改一下登陆密码: 这是从网上找的一个方法,加以总结得出来的,亲测可以:# /etc/i ...

  3. 如何使用UltraCompare对比两个文件夹内容差异

    http://jingyan.baidu.com/article/cb5d6105e13599005c2fe0f8.html  

  4. dubbo框架----探索-大型系统架构设计(图解)

    对于高并发系统的架构要求: 1. 负载均衡 2.高并发 3.高可用 4.面向服务架构 (Dubbo框架使用) 5.分布式缓存 (redis分布式缓存) 6.分布式全文检索 (solr分分布式全文检索) ...

  5. php缓存技术总结

          缓存是指临时文件交换区,电脑把最常用的文件从存储器里提出来临时放在缓存里,就像把工具和材料搬上工作台一样,这样会比用时现去仓库取更方便.因为缓存往往使用的是RAM(断电即掉的非永久储存), ...

  6. AngularJS 国际化——Angular-translate

    对于一个用户群面向全球的的应用来说,不得不考虑国际化的问题.当然,即便是刚刚起步的小应用,如果有心搞大,也应该提前设计国际化的方案. 本篇讲述使用AngularJS构建的应用的简单国际化方案,准确的说 ...

  7. Mac Pro 安装 Homebrew 软件包管理工具

    Linux系统有个让人蛋疼的通病,软件包依赖,好在当前主流的两大发行版本都自带了解决方案,Red hat有 yum,Ubuntu有 apt-get. Mac os 中没有类似的东东,不过有第三方库支持 ...

  8. java遍历map的四种方式

    在Java中如何遍历Map对象 How to Iterate Over a Map in Java 在java中遍历Map有不少的方法.我们看一下最常用的方法及其优缺点. 既然java中的所有map都 ...

  9. Android学习笔记函数

    //调用新的Activity Intent intent=new Intent(MainActivity.this,Main2Activity.class); startActivity(intent ...

  10. Javascript高级程序设计——javascript简介

    1.Javascript简史 javascript诞生于1995年,是由网景公司的Brendan Eich开发的,最初的目的是在客户端处理一些输入验证操作,自此后成为常见浏览器的特色功能,如今用途已经 ...