Giter Club home page Giter Club logo

testing's Introduction

Testing

Tests Codecov

requirements_dev.txt contains packages for running tests.

Directory Structure

Use tree with flag -a to print all files, -I to exclude some files, and pipe the output to clip.exe to copy to clipboard.

Command to generate tree structure:

tree -a -I '<files_to_be_excluded>|.git|.venv|<more_files_or_folders>' | clip.exe
.
├── .github
│   └── workflows
│       └── tests.yml
├── .gitignore
├── README.md
├── pyproject.toml
├── requirements.txt
├── requirements_dev.txt
├── setup.cfg
├── setup.py
├── src
│   └── data_structures
│       ├── __init__.py
│       └── linked_list.py
├── tests
│   ├── __init__.py
│   ├── conftest.py
│   ├── test_linked_list.py
│   └── test_linked_list_node.py
└── tox.ini

Running tests

For mypy, testing only the src directory:

mypy src

For flake8, to test both the src and tests directory:

flake8 src tests

For pytest:

pytest

Generate pytest coverage report with:

pytest --cov-report='html'

Static Type Checking

MyPy is a static type checker, to check if variable types are what you expect them to be.

MyPy's is None type guard, to check if something is None or not:

def func(val: Optional[str]):
    """Example for `is None` type guard."""
    if val is not None:
        # explicitly use `val is not None`, not just `val`
        # Here, type of val is narrowed to str
        print(val)
    else:
        # can optionally skip else
        # Type of val is now narrowed to None
        pass

testing's People

Contributors

ismaildawoodjee avatar

Watchers

 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.