Git Product home page Git Product logo

receives's Introduction

receives

Build Status Coverage Status GitHub license Read the docs

receives is a easy to use mocking library for python 3 and python 2.7 to make testing more easy.

Documentation can be found at Read the docs.

  from receives import receives
  from mylib import Stack


  @receives
  def test_stack(receive):
    stack = Stack()

    receive(stack, "push").with_args("Hello").and_call_original()
    receive(stack, "push").with_args("World").and_call_original()

    receive(stack, "pop").and_return("some value")
    receive(stack, "pop").and_call_original()

    stack.push("Hello")
    stack.push("World")

    assert(stack.pop() == "some value")
    assert(stack.pop() == "Hello")
    assert(stack.pop() == "World")

    # E AssertionError: Expected stack.pop to run 2 times but run 3 times.

Installation

via pip:

  $ pip install receives

or via git:

  $ git clone https://github.com/felixsch/receives.git
  $ cd receives
  $ python setup.py install

Issues & Features

Do you found a bug or you want to see a feature in receives? Open a new GitHub issue!

Development

To install receives in development mode:

  $ git clone https://github.com/felixsch/receives.git
  $ cd receives
  $ pip install -r devel-requirements.txt
  $ python setup.py develop

To run tests:

  $ cd receives
  $ tox

Contribute

I love to hear from you. Fork the project and open a pull request! If you want to make big changes, please contact me before to make sure the pull request gets into master!

receives's People

Contributors

felixsch 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.