Git Product home page Git Product logo

yuanmahui's Introduction

yuanmahui

源码会: 每周阅读一个项目源码,文章在:https://game404.github.io/

  • python
    • redis
    • requests
    • bottle
    • http-server
    • wsgiref
  • golang

简单测试

cd python/ch1-redis
python test_sample.py

使用pytest

测试requests下所有用例:

cd python/ch2-requests
pytest -s

测试结果:

(.venv) ➜  ch2-requests git:(main) ✗ pytest -s
================================================= test session starts ==================================================
platform darwin -- Python 3.8.5, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /Users/yoo/work/yuanmahui/python/ch2-requests
collected 3 items

test_sample.py 401
application/json; charset=utf-8
utf-8
{"message":"Requires authentication","documentation_url":"https://docs.github.com/rest/reference/users#get-the-authenticated-user"}
{'message': 'Requires authentication', 'documentation_url': 'https://docs.github.com/rest/reference/users#get-the-authenticated-user'}
.{"name": "game404", "age": 2}
{
  "age": 2,
  "name": "game404"
}
.game404
.

================================================== 3 passed in 1.89s ===================================================

可以使用下面命令测试单个函数:

pytest test_sample.py::test_json_pretty_print

致谢

  • jetbrains的开源license的支持

https://www.jetbrains.com/

yuanmahui's People

Contributors

game404 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.