Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
K
kb
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • granite
  • kb
  • Wiki
    • Knowledge_share
  • doctest&typing

doctest&typing · Changes

Page history
Update doctest&typing authored Sep 14, 2021 by 王鹏举's avatar 王鹏举
Hide whitespace changes
Inline Side-by-side
Showing with 4 additions and 4 deletions
+4 -4
  • knowledge_share/doctest&typing.md knowledge_share/doctest&typing.md +4 -4
  • No files found.
knowledge_share/doctest&typing.md
View page @ 5810b322
......@@ -23,10 +23,10 @@ Python中的文档测试与类型标注
## `doctest`模块使用
### `testmod()`方法
- 见[doctest_example.py](doctest_example.py)
- 见[doctest_example.py](doctest&typing/doctest_example.py)
### `testfile()`方法
- 见`doctest_example.py`
- 见[doctest_example.py](doctest&typing/doctest_example.py)
- 替代品 `python -m doctest -v doctest_example.txt`
## 输出内容
......@@ -34,14 +34,14 @@ Python中的文档测试与类型标注
- 若还要输出正确的,在CLI中添加`-v`参数
## 例外
- 见`doctest_exceptions_example.py`
- 见[doctest_exceptions_example.py](doctest&typing/doctest_exceptions_example.py)
- 常用
- `# doctest: +ELLIPSIS`
- `# doctest: +SKIP`
- [doctest Directives](https://docs.python.org/zh-cn/3.7/library/doctest.html#directives)
## doctest原理
- 见`how_doctest_works.py`
- 见[how_doctest_works.py](doctest&typing/how_doctest_works.py)
- 对象(`module`, `class`, `function`)的`__doc__`属性
- `globs`参数 注入测试执行上下文
- 可以是自己构建的`dict`可以是`locals()`, `globals()`
......
Clone repository
  • README
  • basic_guidelines
  • basic_guidelines
    • basic_guidelines
    • dev_guide
    • project_build
    • 开发流程
  • best_practice
  • best_practice
    • AlterTable
    • RDS
    • azkaban
    • create_table
    • design
    • elasticsearch
    • elasticsearch
      • ES运维
    • logstash
View All Pages