Codebase list python-mockito / debian/0.5.2-0kali1
debian/0.5.2-0kali1

Tree @debian/0.5.2-0kali1 (Download .tar.gz)

Mockito is a spying framework based on Java library with the same name.

  1. To install:
$ python setup.py install
  1. To run all tests:

System Message: INFO/1 (<string>, line 7)

Enumerated list start value not ordinal-1: "2" (ordinal 2)
$ python setup.py test
  1. For more info, see:

System Message: INFO/1 (<string>, line 11)

Enumerated list start value not ordinal-1: "3" (ordinal 3)
Feel free to contribute more documentation or feedback!
  1. Our user and developer discussion group is:

System Message: INFO/1 (<string>, line 17)

Enumerated list start value not ordinal-1: "4" (ordinal 4)
  1. Mockito is licensed under the MIT license
  2. Library was tested with the following Python versions:

System Message: INFO/1 (<string>, line 21)

Enumerated list start value not ordinal-1: "5" (ordinal 5)
Python 2.4.6 Python 2.5.4 Python 2.6.1 Python 2.7 Python 3.1.2
  1. (Generated from mockito_demo_test.py) Basic usage:

System Message: INFO/1 (<string>, line 31)

Enumerated list start value not ordinal-1: "7" (ordinal 7)

import unittest from mockito import mock, when, verify

class DemoTest(unittest.TestCase):
def testStubbing(self):

# create a mock ourMock = mock()

# stub it when(ourMock).getStuff("cool").thenReturn("cool stuff")

# use the mock self.assertEqual("cool stuff", ourMock.getStuff("cool"))

# what happens when you pass different argument? self.assertEqual(None, ourMock.getStuff("different argument"))

def testVerification(self):

# create a mock theMock = mock()

# use the mock theMock.doStuff("cool")

# verify the interactions. Method and parameters must match. Otherwise verification error. verify(theMock).doStuff("cool")

Docutils System Messages

System Message: ERROR/3 (<string>, line 61)

Anonymous hyperlink mismatch: 0 references but 2 targets. See "backrefs" attribute for IDs.