当前位置: 首页 > news >正文

江苏网站备案流程seo怎么做排名

江苏网站备案流程,seo怎么做排名,百度联盟网站备案信息,网站头部特效<< 返回目录 1 pytest学习笔记 - 1.1 运行pytest 1.1 运行pyest 在命令行执行pytest --help usage: pytest [options] [file_or_dir] [file_or_dir] [...] ... ...1.1.1 pytest不携带参数 pytest不带参数时&#xff0c;会扫描当前目录下的所有目录、子目录中符合测试用…

<< 返回目录

1 pytest学习笔记 - 1.1 运行pytest

1.1 运行pyest

  在命令行执行pytest --help

usage: pytest [options] [file_or_dir] [file_or_dir] [...]
... ...

1.1.1 pytest不携带参数

  pytest不带参数时,会扫描当前目录下的所有目录、子目录中符合测试用例标准的文件(test_*.py, *_test.py),并执行这些文件。

1.1.2 pytest携带文件名、目录、或者文件列表、目录列表

  • 携带文件名:执行指定文件名中的测试用例(函数名满足test_...)。
  • 携带目录名:执行指定目录中的所有测试文件中的所有测试用例(文件名满足:test_....py..._test.py)。
  • 携带文件列表:执行文件列表中所有文件中的所有测试用例。
  • 携带目录列表:执行指定目录列表中的所有测试文件中的所有用例(会递归扫描所有子目录)。

1.2 实战案例

1.2.1 样例1:命名元组对象测试-1

执行命令: pytest -sv test_ch1_001.py

# ---------------------------------------------------------------------------
# @file       test_ch1_001.py
# @brief      测试用例样例
# ---------------------------------------------------------------------------from collections import namedtuple
Task = namedtuple('Task', ['summary', 'owner', 'done', 'id'])
Task.__new__.__defaults__ = (None, None, False, None)def test_defaults():"""Using no parameters should invoke defaults."""t1 = Task()t2 = Task(None, None, False, None) assert t1 == t2def test_member_access():"""Check .field functionality of namedtuple."""t = Task('buy milk', 'brian')assert t.summary == 'buy milk'assert t.owner == 'brian'assert (t.done, t.id) == (False, None)

输出报文:

============================= test session starts =============================
platform win32 -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0 -- C:\Program Files\Python313\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.13.1', 'Platform': 'Windows-10-10.0.19045-SP0', 'Packages': {'pytest': '8.3.4', 'pluggy': '1.5.0'}, 'Plugins': {'check': '2.4.1', 'html': '4.1.1', 'metadata': '3.1.1', 'timeout': '2.3.1', 'xdist': '3.6.1'}}
rootdir: D:\TYYSOFT\Study\Python\pytest
configfile: pytest.ini
plugins: check-2.4.1, html-4.1.1, metadata-3.1.1, timeout-2.3.1, xdist-3.6.1
collecting ... collected 2 itemstest_ch1_001.py::test_defaults PASSED
test_ch1_001.py::test_member_access PASSED- Generated html report: file:///D:/TYYSOFT/Study/Python/pytest/tasks/report.html -
============================== 2 passed in 0.03s ==============================

1.2.2 样例2:命名元组对象测试-2

执行命令:pytest -sv test_ch1_002.py

# ---------------------------------------------------------------------------
# @file       test_ch1_002.py
# @brief      测试命名元组
# ---------------------------------------------------------------------------from collections import namedtupleTask = namedtuple('Task', ['summary', 'owner', 'done', 'id']) 
Task.__new__.__defaults__ = (None, None, False, None)def test_asdict():"""_asdict() should return a dictionary."""t_task = Task('do something', 'okken', True, 21) t_dict = t_task._asdict()expected = {'summary': 'do something','owner': 'okken', 'done': True, 'id': 21}assert t_dict == expecteddef test_replace():"""replace() should change passed in fields."""t_before = Task('finish book', 'brian', False) t_after = t_before._replace(id=10, done=True) t_expected = Task('finish book', 'brian', True, 10) assert t_after == t_expected

输出结果:

============================= test session starts =============================
platform win32 -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0 -- C:\Program Files\Python313\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.13.1', 'Platform': 'Windows-10-10.0.19045-SP0', 'Packages': {'pytest': '8.3.4', 'pluggy': '1.5.0'}, 'Plugins': {'check': '2.4.1', 'html': '4.1.1', 'metadata': '3.1.1', 'timeout': '2.3.1', 'xdist': '3.6.1'}}
rootdir: D:\TYYSOFT\Study\Python\pytest
configfile: pytest.ini
plugins: check-2.4.1, html-4.1.1, metadata-3.1.1, timeout-2.3.1, xdist-3.6.1
collecting ... collected 2 itemstest_ch1_002.py::test_asdict PASSED
test_ch1_002.py::test_replace PASSED- Generated html report: file:///D:/TYYSOFT/Study/Python/pytest/tasks/report.html -
============================== 2 passed in 0.03s ==============================

1.2.3 样例3:运行文件列表

执行命令

 pytest test_ch1_001.py test_ch1_002.py
======================================= test session starts =======================================
platform win32 -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0
rootdir: D:\TYYSOFT\Study\Python\pytest
configfile: pytest.ini
plugins: check-2.4.1, html-4.1.1, metadata-3.1.1, timeout-2.3.1, xdist-3.6.1
collected 4 itemstest_ch1_001.py ..                                                                           [ 50%]
test_ch1_002.py ..                                                                           [100%]--------- Generated html report: file:///D:/TYYSOFT/Study/Python/pytest/tasks/report.html ---------
======================================== 4 passed in 0.03s ========================================

注:其他种运行方式,读者可以自行尝试。


作者声明:本文用于记录和分享作者的学习心得,可能有部分文字或示例来源自豆包AI,由于本人水平有限,难免存在表达错误,欢迎留言交流和指教!
Copyright © 2022~2025 All rights reserved.

<< 返回目录

http://www.tj-hxxt.cn/news/8353.html

相关文章:

  • 大兴网站建设制作竞价排名深度解析
  • 公司主页制作南京百度seo排名优化
  • 网站怎么没有排名建网站费用
  • 夜场网站建设深圳全网营销型网站
  • 给网站做选题互联网项目推广平台有哪些
  • 怎么创建网页的桌面快捷方式seo网站排名软件
  • 家纺代发网站建设北京环球影城每日客流怎么看
  • wordpress dbseo排名赚靠谱吗
  • 做网站要会写什么seo技术教学视频
  • wordpress 增加备案号快速排名优化怎么样
  • 网站工作和网站建设管理工作手游推广渠道平台
  • 政务服务网站建设资金搜索词分析
  • 建设银行人力资源系统网站怎么进小广告怎么能弄干净
  • 电子商务实验网站建设实训过程推广软文300字
  • 学做烘焙的网站大型网站建设方案
  • wordpress移动底部菜单上海seo顾问推推蛙
  • 新闻网站跟贴怎么做百度经验发布平台
  • 深圳品牌网站设计电话seo关键词优化指南
  • 免费手机建网站平台抖音推广方式有哪些
  • 吉林省建设厅网站市政建设陕西企业网站建设
  • 网站建设意见反馈表网站建站流程
  • 网站设计与网页制作教程药品销售推广方案
  • 网站开发中使用框架吗长春seo排名扣费
  • 网站模板框架seo专员是什么职业
  • 营销型外贸网站建设软件怎样注册自己网站的域名
  • 学校要求做网站如何优化seo关键词
  • 厦门站长优化工具网络广告营销的概念
  • 怎么做网站弹窗通知广东广州疫情最新情况
  • 做设计用哪个素材网站宁波靠谱营销型网站建设
  • 手机端做网站软件seo黑帽是什么