Pytest编写测试函数
Pytest编写测试函数
一个规范的测试方法一定带有断言,在使用pytest时,可以直接使用Python自带的assert关键字

Pytest允许在assert关键字添加任意表达式,表达式的值通过bool转换后等于False则表示断言失败,测试用例执行失败;如果等于True则表示断言成功,测试用例执行成功。
重写assertpytest
可以重写assert关键字,它可以截断对原生assert的调用,替换为pytest定义的assert,从而展示更详细的信息和细节。
from collections import namedtuple
Task = namedtuple('Task', ['summary','owner','done','id'])
# __new__.__defaults__创建默认的Task对象
Task.__new__.__defaults__ = (None, None, False, None) import pytest def test_task_equality():
t1 = Task('sit there', 'brain')
t2 = Task('do something', 'okken')
print(t1)
print(t2)
assert t1 == t2 def test_dict_equal():
t1_dict = Task('make sandwich', 'okken')._asdict()
t2_dict = Task('make sandwich', 'okkem')._asdict()
print(t1_dict)
print(t2_dict)
assert t1_dict == t2_dict
执行结果如下:
E:\Programs\Python\Python_Pytest\TestScripts>pytest test_three.py
======================= test session starts ==========================
platform win32 -- Python 3.7.3, pytest-4.5.0, py-1.8.0, pluggy-0.11.0
rootdir: E:\Programs\Python\Python_Pytest\TestScripts
plugins: xdist-1.29.0, timeout-1.3.3, repeat-0.8.0, instafail-0.4.1, forked-1.0.2, emoji-0.2.0, allure-pytest-2.6.3
collected 2 items test_three.py FF [100%] ===================== FAILURES ==================================
_____________________ test_task_equality _______________________________ def test_task_equality():
t1 = Task('sit there', 'brain')
t2 = Task('do something', 'okken')
print(t1)
print(t2)
> assert t1 == t2
E AssertionError: assert Task(summary=...alse, id=None) == Task(summary='...alse, id=None)
E At index 0 diff: 'sit there' != 'do something'
E Use -v to get the full diff test_three.py:14: AssertionError
-------------------- Captured stdout call ----------------------------------------
Task(summary='sit there', owner='brain', done=False, id=None)
Task(summary='do something', owner='okken', done=False, id=None)
________________ test_dict_equal ______________________________ def test_dict_equal():
t1_dict = Task('make sandwich', 'okken')._asdict()
t2_dict = Task('make sandwich', 'okkem')._asdict()
print(t1_dict)
print(t2_dict)
> assert t1_dict == t2_dict
E AssertionError: assert OrderedDict([...('id', None)]) == OrderedDict([(...('id', None)])
E Omitting 3 identical items, use -vv to show
E Differing items:
E {'owner': 'okken'} != {'owner': 'okkem'}
E Use -v to get the full diff test_three.py:22: AssertionError
------------------------------- Captured stdout call --------------------------------------------
OrderedDict([('summary', 'make sandwich'), ('owner', 'okken'), ('done', False), ('id', None)])
OrderedDict([('summary', 'make sandwich'), ('owner', 'okkem'), ('done', False), ('id', None)])
================ 2 failed in 0.20 seconds=============================
加上参数-v,执行结果如下:
E:\Programs\Python\Python_Pytest\TestScripts>pytest test_three.py -v
================= test session starts ===============================
platform win32 -- Python 3.7.3, pytest-4.5.0, py-1.8.0, pluggy-0.11.0 -- c:\python37\python.exe
cachedir: .pytest_cache
rootdir: E:\Programs\Python\Python_Pytest\TestScripts
plugins: xdist-1.29.0, timeout-1.3.3, repeat-0.8.0, instafail-0.4.1, forked-1.0.2, emoji-0.2.0, allure-pytest-2.6.3
collected 2 items test_three.py::test_task_equality FAILED [ 50%]
test_three.py::test_dict_equal FAILED [100%] ==================== FAILURES =========================
____________________ test_task_equality ________________________ def test_task_equality():
t1 = Task('sit there', 'brain')
t2 = Task('do something', 'okken')
print(t1)
print(t2)
> assert t1 == t2
E AssertionError: assert Task(summary=...alse, id=None) == Task(summary='...alse, id=None)
E At index 0 diff: 'sit there' != 'do something'
E Full diff:
E - Task(summary='sit there', owner='brain', done=False, id=None)
E ? ^^^ ^^^ ^^^^
E + Task(summary='do something', owner='okken', done=False, id=None)
E ? +++ ^^^ ^^^ ^^^^ test_three.py:14: AssertionError
-------------------- Captured stdout call -----------------------------------
Task(summary='sit there', owner='brain', done=False, id=None)
Task(summary='do something', owner='okken', done=False, id=None)
____________________ test_dict_equal ________________________________ def test_dict_equal():
t1_dict = Task('make sandwich', 'okken')._asdict()
t2_dict = Task('make sandwich', 'okkem')._asdict()
print(t1_dict)
print(t2_dict)
> assert t1_dict == t2_dict
E AssertionError: assert OrderedDict([...('id', None)]) == OrderedDict([(...('id', None)])
E Omitting 3 identical items, use -vv to show
E Differing items:
E {'owner': 'okken'} != {'owner': 'okkem'}
E Full diff:
E OrderedDict([('summary', 'make sandwich'),
E - ('owner', 'okken'),
E ? ^...
E
E ...Full output truncated (5 lines hidden), use '-vv' to show test_three.py:22: AssertionError
--------------------------- Captured stdout call --------------------------------
OrderedDict([('summary', 'make sandwich'), ('owner', 'okken'), ('done', False), ('id', None)])
OrderedDict([('summary', 'make sandwich'), ('owner', 'okkem'), ('done', False), ('id', None)])
================= 2 failed in 0.13 seconds ============================
预期异常
"""
在Task项目的API中,有几个地方可能抛出异常
def add(task): # type:(Task) ->int
def get(task_id): # type:(int) ->Task
def list_tasks(owner=None): # type:(str|None) ->list of task
def count(): # type:(None) ->int
def update(task_id, task): # type:(int, Task) ->None
def delete(task_id): # type:(int) ->None
def delete_all(): # type:() ->None
def unique_id(): # type:() ->int
def start_tasks_db(db_path, db_type): # type:(str, str) ->None
def stop_tasks_db(): # type:() ->None
""" import pytest
import tasks def test_add_raises():
with pytest.raises(TypeError):
tasks.add(task='no a Task object') """
测试用例中有with pytest.raise(TypeError)生命,意味着无论with结构中的内容是什么
都至少会发生TypeError异常,如果测试通过,说明确实发生了我们预期TypeError,如果抛出的是其他类型的异常
则与我们预期的异常不一致,测试用例执行失败
""" def test_start_tasks_db_raises():
with pytest.raises(ValueError) as excinfo:
tasks.start_tasks_db('some/great/path', 'mysql')
exception_msg = excinfo.value.args[0]
assert exception_msg == "db_type must be a 'tiny' or 'mongo' "
测试函数的标记
from collections import namedtuple
import pytest
Task = namedtuple('Task', ['summary','owner','done','id'])
# __new__.__defaults__创建默认的Task对象
Task.__new__.__defaults__ = (None, None, False, None) @pytest.mark.smoke
def test_task_equality():
t1 = Task('sit there', 'brain')
t2 = Task('do something', 'okken')
print(t1)
print(t2)
assert t1 == t2 @pytest.mark.dict
@pytest.mark.smoke
def test_dict_equal():
t1_dict = Task('make sandwich', 'okken')._asdict()
t2_dict = Task('make sandwich', 'okkem')._asdict()
print(t1_dict)
print(t2_dict)
assert t1_dict == t2_dict
执行结果如下:
E:\Programs\Python\Python_Pytest\TestScripts>pytest -v -m 'smoke' test_five.py
================ test session starts =====================
platform win32 -- Python 3.7.3, pytest-4.5.0, py-1.8.0, pluggy-0.11.0 -- c:\python37\python.exe
cachedir: .pytest_cache
rootdir: E:\Programs\Python\Python_Pytest\TestScripts
plugins: xdist-1.29.0, timeout-1.3.3, repeat-0.8.0, instafail-0.4.1, forked-1.0.2, emoji-0.2.0, allure-pytest-2.6.3
collected 2 items test_five.py::test_task_equality FAILED [ 50%]
test_five.py::test_dict_equal FAILED [100%] =================== FAILURES ==============================
______________ test_task_equality _________________________
@pytest.mark.smoke
def test_task_equality():
t1 = Task('sit there', 'brain')
t2 = Task('do something', 'okken')
print(t1)
print(t2)
> assert t1 == t2
E AssertionError: assert Task(summary=...alse, id=None) == Task(summary='...alse, id=None)
E At index 0 diff: 'sit there' != 'do something'
E Full diff:
E - Task(summary='sit there', owner='brain', done=False, id=None)
E ? ^^^ ^^^ ^^^^
E + Task(summary='do something', owner='okken', done=False, id=None)
E ? +++ ^^^ ^^^ ^^^^ test_five.py:14: AssertionError
----------------------- Captured stdout call ----------------------------------
Task(summary='sit there', owner='brain', done=False, id=None)
Task(summary='do something', owner='okken', done=False, id=None)
___________________ test_dict_equal ___________________
@pytest.mark.dict
@pytest.mark.smoke
def test_dict_equal():
t1_dict = Task('make sandwich', 'okken')._asdict()
t2_dict = Task('make sandwich', 'okkem')._asdict()
print(t1_dict)
print(t2_dict)
> assert t1_dict == t2_dict
E AssertionError: assert OrderedDict([...('id', None)]) == OrderedDict([(...('id', None)])
E Omitting 3 identical items, use -vv to show
E Differing items:
E {'owner': 'okken'} != {'owner': 'okkem'}
E Full diff:
E OrderedDict([('summary', 'make sandwich'),
E - ('owner', 'okken'),
E ? ^...
E
E ...Full output truncated (5 lines hidden), use '-vv' to show test_five.py:24: AssertionError
------------------------ Captured stdout call -------------------------------
OrderedDict([('summary', 'make sandwich'), ('owner', 'okken'), ('done', False), ('id', None)])
OrderedDict([('summary', 'make sandwich'), ('owner', 'okkem'), ('done', False), ('id', None)])
================ warnings summary =========================
c:\python37\lib\site-packages\_pytest\mark\structures.py:324
c:\python37\lib\site-packages\_pytest\mark\structures.py:324: PytestUnknownMarkWarning: Unknown pytest.mark.smoke - is this a typo? You can register custom marks to avoi
d this warning - for details, see https://docs.pytest.org/en/latest/mark.html
PytestUnknownMarkWarning, c:\python37\lib\site-packages\_pytest\mark\structures.py:324
c:\python37\lib\site-packages\_pytest\mark\structures.py:324: PytestUnknownMarkWarning: Unknown pytest.mark.dict - is this a typo? You can register custom marks to avoid
this warning - for details, see https://docs.pytest.org/en/latest/mark.html
PytestUnknownMarkWarning, -- Docs: https://docs.pytest.org/en/latest/warnings.html
============== 2 failed, 2 warnings in 0.22 seconds =======================
在命令行执行使用了 -m marker_name参数,pytest在执行时会自动寻找被标记为marker_name的测试方法去执行,同时-m还支持and、or、not关键字,如下方式:
E:\Programs\Python\Python_Pytest\TestScripts>pytest -v -m "smoke and not dict" test_five.py
=========== test session starts ==============================
platform win32 -- Python 3.7.3, pytest-4.5.0, py-1.8.0, pluggy-0.11.0 -- c:\python37\python.exe
cachedir: .pytest_cache
rootdir: E:\Programs\Python\Python_Pytest\TestScripts
plugins: xdist-1.29.0, timeout-1.3.3, repeat-0.8.0, instafail-0.4.1, forked-1.0.2, emoji-0.2.0, allure-pytest-2.6.3
collected 2 items / 1 deselected / 1 selected test_five.py::test_task_equality FAILED [100%] =============== FAILURES ==================
_______________ test_task_equality ____________________________ @pytest.mark.smoke
def test_task_equality():
t1 = Task('sit there', 'brain')
t2 = Task('do something', 'okken')
print(t1)
print(t2)
> assert t1 == t2
E AssertionError: assert Task(summary=...alse, id=None) == Task(summary='...alse, id=None)
E At index 0 diff: 'sit there' != 'do something'
E Full diff:
E - Task(summary='sit there', owner='brain', done=False, id=None)
E ? ^^^ ^^^ ^^^^
E + Task(summary='do something', owner='okken', done=False, id=None)
E ? +++ ^^^ ^^^ ^^^^ test_five.py:14: AssertionError
--------------- Captured stdout call ------------------------------
Task(summary='sit there', owner='brain', done=False, id=None)
Task(summary='do something', owner='okken', done=False, id=None)
================ warnings summary ====================
c:\python37\lib\site-packages\_pytest\mark\structures.py:324
c:\python37\lib\site-packages\_pytest\mark\structures.py:324: PytestUnknownMarkWarning: Unknown pytest.mark.smoke - is this a typo? You can register custom marks to avoi
d this warning - for details, see https://docs.pytest.org/en/latest/mark.html
PytestUnknownMarkWarning, c:\python37\lib\site-packages\_pytest\mark\structures.py:324
c:\python37\lib\site-packages\_pytest\mark\structures.py:324: PytestUnknownMarkWarning: Unknown pytest.mark.dict - is this a typo? You can register custom marks to avoid
this warning - for details, see https://docs.pytest.org/en/latest/mark.html
PytestUnknownMarkWarning, -- Docs: https://docs.pytest.org/en/latest/warnings.html
============= 1 failed, 1 deselected, 2 warnings in 0.14 seconds ===========
跳过测试
from collections import namedtuple
import pytest
Task = namedtuple('Task', ['summary','owner','done','id'])
# __new__.__defaults__创建默认的Task对象
Task.__new__.__defaults__ = (None, None, False, None) @pytest.mark.smoke
def test_task_equality():
t1 = Task('sit there', 'brain')
t2 = Task('do something', 'okken')
print(t1)
print(t2)
assert t1 == t2 @pytest.mark.dict
@pytest.mark.smoke
@pytest.mark.skip(reason="跳过原因你不知道吗?")
def test_dict_equal():
t1_dict = Task('make sandwich', 'okken')._asdict()
t2_dict = Task('make sandwich', 'okkem')._asdict()
print(t1_dict)
print(t2_dict)
assert t1_dict == t2_dict
执行结果:
E:\Programs\Python\Python_Pytest\TestScripts>pytest -v test_five.py
=============== test session starts ===================================
platform win32 -- Python 3.7.3, pytest-4.5.0, py-1.8.0, pluggy-0.11.0 -- c:\python37\python.exe
cachedir: .pytest_cache
rootdir: E:\Programs\Python\Python_Pytest\TestScripts
plugins: xdist-1.29.0, timeout-1.3.3, repeat-0.8.0, instafail-0.4.1, forked-1.0.2, emoji-0.2.0, allure-pytest-2.6.3
collected 2 items test_five.py::test_task_equality FAILED [ 50%]
test_five.py::test_dict_equal SKIPPED [100%] ============== FAILURES ==================================
__________________ test_task_equality _______________________________ @pytest.mark.smoke
def test_task_equality():
t1 = Task('sit there', 'brain')
t2 = Task('do something', 'okken')
print(t1)
print(t2)
> assert t1 == t2
E AssertionError: assert Task(summary=...alse, id=None) == Task(summary='...alse, id=None)
E At index 0 diff: 'sit there' != 'do something'
E Full diff:
E - Task(summary='sit there', owner='brain', done=False, id=None)
E ? ^^^ ^^^ ^^^^
E + Task(summary='do something', owner='okken', done=False, id=None)
E ? +++ ^^^ ^^^ ^^^^ test_five.py:14: AssertionError
------------------ Captured stdout call --------------------------------
Task(summary='sit there', owner='brain', done=False, id=None)
Task(summary='do something', owner='okken', done=False, id=None)
=========== warnings summary ==============================
c:\python37\lib\site-packages\_pytest\mark\structures.py:324
c:\python37\lib\site-packages\_pytest\mark\structures.py:324: PytestUnknownMarkWarning: Unknown pytest.mark.smoke - is this a typo? You can register custom marks to avoi
d this warning - for details, see https://docs.pytest.org/en/latest/mark.html
PytestUnknownMarkWarning, c:\python37\lib\site-packages\_pytest\mark\structures.py:324
c:\python37\lib\site-packages\_pytest\mark\structures.py:324: PytestUnknownMarkWarning: Unknown pytest.mark.dict - is this a typo? You can register custom marks to avoid
this warning - for details, see https://docs.pytest.org/en/latest/mark.html
PytestUnknownMarkWarning, -- Docs: https://docs.pytest.org/en/latest/warnings.html
=========== 1 failed, 1 skipped, 2 warnings in 0.21 seconds ================
从测试结果中我们看到,测试用例test_five.py::test_dict_equal SKIPPED 被跳过了,然而跳过原因并没有如期的展示出来,可以使用参数-rs来展示跳过原因,如下方式:
E:\Programs\Python\Python_Pytest\TestScripts>pytest -rs test_five.py
===================== test session starts ===========================
platform win32 -- Python 3.7.3, pytest-4.5.0, py-1.8.0, pluggy-0.11.0
rootdir: E:\Programs\Python\Python_Pytest\TestScripts
plugins: xdist-1.29.0, timeout-1.3.3, repeat-0.8.0, instafail-0.4.1, forked-1.0.2, emoji-0.2.0, allure-pytest-2.6.3
collected 2 items test_five.py Fs [100%] ============ FAILURES ====================================
__________________________ test_task_equality _______________________
@pytest.mark.smoke
def test_task_equality():
t1 = Task('sit there', 'brain')
t2 = Task('do something', 'okken')
print(t1)
print(t2)
> assert t1 == t2
E AssertionError: assert Task(summary=...alse, id=None) == Task(summary='...alse, id=None)
E At index 0 diff: 'sit there' != 'do something'
E Use -v to get the full diff test_five.py:14: AssertionError
-------------------- Captured stdout call ----------------------------------
Task(summary='sit there', owner='brain', done=False, id=None)
Task(summary='do something', owner='okken', done=False, id=None)
========== warnings summary ====================
c:\python37\lib\site-packages\_pytest\mark\structures.py:324
c:\python37\lib\site-packages\_pytest\mark\structures.py:324: PytestUnknownMarkWarning: Unknown pytest.mark.smoke - is this a typo? You can register custom marks to avoi
d this warning - for details, see https://docs.pytest.org/en/latest/mark.html
PytestUnknownMarkWarning, c:\python37\lib\site-packages\_pytest\mark\structures.py:324
c:\python37\lib\site-packages\_pytest\mark\structures.py:324: PytestUnknownMarkWarning: Unknown pytest.mark.dict - is this a typo? You can register custom marks to avoid
this warning - for details, see https://docs.pytest.org/en/latest/mark.html
PytestUnknownMarkWarning, -- Docs: https://docs.pytest.org/en/latest/warnings.html
============ short test summary info ====================
SKIPPED [1] test_five.py:17: 跳过原因你不知道吗?
========== 1 failed, 1 skipped, 2 warnings in 0.14 seconds =================
还可以给跳过添加理由,例如当selenium版本是1.0.4的时候跳过
from collections import namedtuple
import pytest
import selenium
Task = namedtuple('Task', ['summary','owner','done','id'])
# __new__.__defaults__创建默认的Task对象
Task.__new__.__defaults__ = (None, None, False, None) @pytest.mark.smoke
def test_task_equality():
t1 = Task('sit there', 'brain')
t2 = Task('do something', 'okken')
print(t1)
print(t2)
assert t1 == t2 @pytest.mark.dict
@pytest.mark.smoke
@pytest.mark.skipif(selenium.__version__ == '1.0.4', reason="跳过原因你不知道吗?")
def test_dict_equal():
t1_dict = Task('make sandwich', 'okken')._asdict()
t2_dict = Task('make sandwich', 'okkem')._asdict()
print(t1_dict)
print(t2_dict)
assert t1_dict == t2_dict
运行测试子集
运行单个目录,只需要将目录作为pytest的参数即可 pytest -v test/func --tb=no
1
运行单个测试函数,只需要在文件名后添加::符号和函数名 pytest -v test/func/test_five.py::test_dict_equal
1
运行单个测试类,与运行单个测试函数类似,在文件名后添加::符号和类名 pytest -v test/func/test_five.py::Test_Update
1
运行单个测试类中的测试方法,在文件名后添加::符号和类名然后再跟::符号和函数名 pytest -v test/func/test_five.py::Test_Update::test_dict_equal
Pytest编写测试函数的更多相关文章
- 【PYTEST】第二章编写测试函数
知识点: assert 测试函数标记 跳过测试 标记预期失败的测试用例 1. asseet 返回的都是布尔值,等于False(F) 就是失败, assert 有很多 assert something ...
- python+pytest接口自动化(12)-自动化用例编写思路 (使用pytest编写一个测试脚本)
经过之前的学习铺垫,我们尝试着利用pytest框架编写一条接口自动化测试用例,来厘清接口自动化用例编写的思路. 我们在百度搜索天气查询,会出现如下图所示结果: 接下来,我们以该天气查询接口为例,编写接 ...
- python+pytest接口自动化(11)-测试函数、测试类/测试方法的封装
前言 在python+pytest 接口自动化系列中,我们之前的文章基本都没有将代码进行封装,但实际编写自动化测试脚本中,我们都需要将测试代码进行封装,才能被测试框架识别执行. 例如单个接口的请求代码 ...
- pytest学习笔记(二)
继续文档的第二章 (一)pytest中可以在命令行中静态/动态添加option,这里没什么好讲的,略过... 这里面主要讲下如何试用skip/xfail,还有incremental(包含一些列的测试步 ...
- Pytest高级进阶之Fixture
From: https://www.cnblogs.com/feiyi211/p/6626314.html 一. fixture介绍 fixture是pytest的一个闪光点,pytest要精通怎么能 ...
- iOS自动化探索(六)自动化测试框架pytest - fixtures
Fixture介绍 fixture是pytest特有的功能,它用pytest.fixture标识,定义在函数前面.在编写测试函数的时候,可以将此函数名称做为传入参数,pytest将会以依赖注入方式,将 ...
- 《带你装B,带你飞》pytest成魔之路4 - fixture 之大解剖
1. 简介 fixture是pytest的一个闪光点,pytest要精通怎么能不学习fixture呢?跟着我一起深入学习fixture吧.其实unittest和nose都支持fixture,但是pyt ...
- pytest学习纪要123-针对经常用到的内容详实记录
pytest123 本文主要参考:https://www.cnblogs.com/yoyoketang/tag/pytest 如有侵权,请站内联系我 目录 pytest123 1.setup和tear ...
- 技术面试没过,居然是没有用pytest测试框架
1.引言 我有一个朋友是做Python自动化测试的.前几天他告诉我去参加一个大厂面试被刷了. 我问他是有没有总结被刷下来的原因.他说面试官问了一些 pytest 单元测试框架相关的知识,包括什么插件系 ...
随机推荐
- 【ARM-Linux开发】Rico Board上编译USB WiFi RT3070驱动
1.附件中提供了RT3070驱动源码包DPO_RT5572_LinuxSTA_2.6.1.3_20121022.tar.gz和编译好的驱动,这里选择使用taget_file.tar.gz中已经编译好的 ...
- in-place数据交换
实现in-place的数据交换 声明:引用请注明出处http://blog.csdn.net/lg1259156776/ 经典的排序问题 问题描述 一个数组中包含两个已经排好序的子数组,设计一个in- ...
- 关于PADS的一些概念和实用技巧(二)
关于PADS的一些概念和实用技巧(二) 声明:引用请注明出处http://blog.csdn.net/lg1259156776/ 1. 关于制作part 首先在logic中绘制CAE封装,在保存元件时 ...
- mysql配置优化的参数
1.MySQL数据库高效优化解析 Mysql优化是一项非常重要的工作,而且是一项长期的工作,曾经有一个为位DBA前辈说过:mysql的优化,三分配置的优化,七分sql语句的优化. Mysql的优化: ...
- python_网络编程_基础
基本的架构有C/S架构 和B/S架构 B/S架构优于C/S架构? 因为统一入口 , 都是从浏览器开始访问 两台电脑实现通信, 需要网卡, 网卡上有全球唯一的mac地址 ARP协议 #通过ip地址就能找 ...
- python while循环 - python基础入门(9)
经过昨天的学习,相信大家已经对 python的条件判断表达式if/else 有一定的了解了,那么我们今天配合昨天的课程讲解一个新概念 – while循环 . 都说程序源于生活,假如有这样一个场景:老师 ...
- Jmeter逻辑控制器: If控制器的解读
Jmeter官网其实有很详细的文档,点此跳转到官网,下面我来解读一下官网的文档,如有错误,欢迎指出. 一.官网解读 Name 在结果树中显示的名字. Comments 备注.相当于代码中的注释. Ex ...
- TypeScript 高级类型
⒈交叉类型(Intersection Types) 交叉类型是将多个类型合并为一个类型. 这让我们可以把现有的多种类型叠加到一起成为一种类型,它包含了所需的所有类型的特性. 例如, Person &a ...
- Visual studio 2010(VS2010) 安装MSDN方法
首先保证VS2010已经安装完毕 1.解压VS2010的安装文件(ISO),会看到ProductDocumentation文件夹,该文件夹下即为MSDN. 2.启动vs2010,点击"帮助& ...
- ARTS第七周打卡
Algorithm : 做一个 leetcode 的算法题 ////////////////////////////////////////////////////////////////////// ...