GithubHelp home page GithubHelp logo

assertions's Introduction

Assertions

Description:

A simple assertion using python. It tests and returns either true or false for the condition in consideration.

Functions:

  1. asserts(value: Any) -> bool

Check if the value passed is True. it is diffrent to the core assert. It returns True or False. No exception is returned.

>>> asserts(True)
True

Below test is expected to Fail.

>>> asserts([])
True
  1. assert_eq(value1: Any, value2: Any) -> bool

Gets two positional parameters. Check if the parameters are the same type. Then check if the parameters are the same.

>>> assert_eq("Lagos", "new yoke")
False

>>> assert_eq([0, 1, 2], list(range(3)))
True
  1. asserts_prnt(value: Any) -> None

Prints returned value of the function asserts. Returns None.

  1. assert_eq_prnt(value1: Any, value2: Any, *, show=False) -> None

Prints returned values of the function assert_eq. Returns None

  1. _print_result(status: bool, *, values: list[Any] = [None], show=False) -> None

It prints out either True or False. It can also show the reason, if the result is false. _print_result is a private function in this package. It takes; a bool, a list and a bool variable. It returns None.

  1. printer(show: bool=False)

A decorator to prints assert_eq. This enables assert_eq to prints, without using the print function. It doesn't only prints the result but shows the result expected and what is gotten, if the result is false.

assertions's People

Contributors

2teez 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.