CategoryTesting: TestingFramework for the PythonLanguage
Pikzie is an easy to write/debug Unit Testing Framework for Python.
Pikzie provides the following features that are lacked in unittest.py included in the standard Python distribution:
- Pythonic API. (Pikzie followes PEP 8 -- Style Guide for Python Code: http://www.python.org/dev/peps/pep-0008/)
- a lot of assertions.
- outputs result with useful format for debugging. (especially Emacs user)
- colorized output.
- supports tagging metadata to each test.
An example test:
import pikzie
from stack import Stack
class TestStack(pikzie.TestCase):
def setup(self):
self.stack = Stack()
def test_new_stack(self):
stack = Stack()
self.assert_true(stack.empty())
def test_push(self):
self.assert_equal(0, len(self.stack))
self.stack.push(100)
self.assert_equal(1, len(self.stack))
self.assert_false(self.stack.empty())
def test_pop(self):
self.stack.push(10)
self.stack.push(20)
self.stack.push(30)
self.assert_equal(3, len(self.stack))
self.assert_equal(30, self.stack.pop())
self.assert_equal(2, len(self.stack))
self.assert_equal(20, self.stack.pop())
self.assert_equal(1, len(self.stack))
self.stack.push(40)
self.assert_equal(2, len(self.stack))
self.assert_equal(40, self.stack.pop())
self.assert_equal(1, len(self.stack))
self.assert_equal(10, self.stack.pop())
self.assert_equal(0, len(self.stack))
self.assert_true(self.stack.empty())
@pikzie.bug(1234)
def test_push_string(self):
self.stack.push("string can be pushed")
self.assert_equal("string can be pushed", self.pop())