A BDD-like test framework
Project description
# Specpy
A [rspec](http://rspec.info/) inspired BDD-like testing framework
# How to use it
Install it from pip with
```bash
pip install specpy
```
Your specs must have the prefix 'spec_' and each spec function must have the decorator 'spec'
# Example
```python
# calculator.py
class Calculator:
def __init__(self):
pass
def add(self, a, b):
return a + b
# specs/spec_calculator.py
from calculator import Calculator
from specpy import *
@spec
def calculator():
with describe('Calculator'):
with context('using only integer as paramters'):
c = Calculator()
with describe('#add'):
with it('should return 3'):
should(c.add(1, 2)).be.equals_to(3)
with it('should not return 3'):
should(c.add(1, 2)).not_be.equals_to(3) # fails
with it('should not return 3'):
should(c.add(1, 3)).not_be.equals_to(3)
```
A [rspec](http://rspec.info/) inspired BDD-like testing framework
# How to use it
Install it from pip with
```bash
pip install specpy
```
Your specs must have the prefix 'spec_' and each spec function must have the decorator 'spec'
# Example
```python
# calculator.py
class Calculator:
def __init__(self):
pass
def add(self, a, b):
return a + b
# specs/spec_calculator.py
from calculator import Calculator
from specpy import *
@spec
def calculator():
with describe('Calculator'):
with context('using only integer as paramters'):
c = Calculator()
with describe('#add'):
with it('should return 3'):
should(c.add(1, 2)).be.equals_to(3)
with it('should not return 3'):
should(c.add(1, 2)).not_be.equals_to(3) # fails
with it('should not return 3'):
should(c.add(1, 3)).not_be.equals_to(3)
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
specpie-1.1.3.post1.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for specpie-1.1.3.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbdcb028d8e57b511a55d04efc04919e91ab9b765b28db263987d57c1dd15f82 |
|
MD5 | edb3f5c3c782b4c9f38374c3171c9f3c |
|
BLAKE2b-256 | 53422e2d8bf1c0fedc9c6f70de01545399a5c9545bf5cefef3a75fd48857db38 |