一、什么是单元测试 单元测试是用来对一个模块、一个函数或者一个类来进行正确性检验的测试工作。如果测试通过则说明我们这个函数或功能能够正常工作,如果失败要么测试用例不正确,要么函数有bug需要修复。 二、如何使用单元测试 from django.test import TestCase from ap ...
分类:
其他好文 时间:
2020-07-19 11:51:22
阅读次数:
121
1. 定义:在函数内部再定义一个函数,并且这个函数用到了外边函数的变量,那么将这个函数以及用到的一些变量称之为闭包 def test(number): print(' 1 ') def test_in(): print(' 2 ') print(number+100) print(' 3 ') re ...
分类:
编程语言 时间:
2020-07-19 11:34:34
阅读次数:
46
int count=a.equal(b)?1:0 上面的三元表达式 用Optional可以近似这样做: public class TestTemp1 { String b; @Test public void test1(){ String a="dd"; b="dd"; int count=Opt ...
分类:
其他好文 时间:
2020-07-19 00:51:06
阅读次数:
75
GenericAPIView为APIView的子类,它拓展了过滤、查询、分页的功能,本章主要介绍过滤的使用方法 一、引入方式 from rest_framework.generics import GenericAPIView 二、GenericAPIView 视图继承GenericAPIView ...
数组中可以存放多个值。Bash Shell 只支持一维数组(不支持多维数组),初始化时不需要定义数组大小(与 PHP 类似)。 与大部分编程语言类似,数组元素的下标由0开始。 Shell 数组用括号来表示,元素用"空格"符号分割开,语法格式如下: array_name=(value1 ... val ...
分类:
编程语言 时间:
2020-07-18 22:46:45
阅读次数:
79
//测试 字符写出流 public class Test4_Writer { public static void main(String[] args) throws IOException { FW();//FileWriter写出流 // BW();//TODO BufferedWriter写 ...
分类:
其他好文 时间:
2020-07-18 22:24:54
阅读次数:
80
仅罗列了一些常用基础配置,更多配置请到官网查看 https://www.elastic.co/guide/en/logstash/current logstash.yml配置文件 # Node identity #节点名称,默认主机名 node.name: test # Data path #数据存 ...
分类:
其他好文 时间:
2020-07-18 22:04:24
阅读次数:
88
后台启动Python脚本可以使用下面的命令来启动上面的脚本,让Python在后台运行。 nohup python -u main.py > test.out 2>&1 &1来解释一下这几个命令的参数。这一段来自http://blog.csdn.net/tswisdom/article/details ...
分类:
编程语言 时间:
2020-07-18 21:48:38
阅读次数:
101
前端编辑器 vscode:免费开源的现代化轻量级代码编辑器,支持大部分主流的开发语言的语法高亮、智能代码补全、自定义热键、代码对比DIFF、GIT等特性,支持插件扩展,软件跨平台支持Win、Mac以及Linux 其他:sublime、hbuilder、webstorm vscode安装地址:http ...
分类:
其他好文 时间:
2020-07-18 20:01:57
阅读次数:
81
1.Test.php <?php namespace app\sample\controller; class Test { public function hello($id,$name){ echo $id; echo '|'; echo $name."<br>"; return 'hello, ...
分类:
Web程序 时间:
2020-07-18 19:52:59
阅读次数:
76