0
I Use This!
Inactive
Analyzed about 10 hours ago. based on code collected about 10 hours ago.

Project Summary

Should DSL implemented in Python

The goal is to write a "should" DSL in Python to be as clear as possible.

should-dsl is at github.com

Due to DVCS I moved should-dsl to github.com. I will try to maintain both repositories up to date, but the github will be the main one.

You can get it at: http://github.com/hugobr/should-dsl

It would be good to be as close as:

SOME_VALUE should be equal to ANOTHER VALUE
or
SOME_EXCEPTION should be thrown by SOME_CALLABLE
or
SOME_VALUE should not be into SOME_CONTAINER

For using this DSL as transparently as possible, you must import on this way:

from should_dsl import *

Some examples using doctest follow:

Should with equal_to:
>>> 1 |should_be.equal_to| 1
True
>>> 2 |should_be.equal_to| 3
Traceback (most recent call last):
...
ShouldNotSatisfied: 2 is not equal to 3

Should with have:
>>> 'should' |should_have| 'oul'
True
>>> [1,2] |should_have| 3
Traceback (most recent call last):
...
ShouldNotSatisfied: [1, 2] does not have 3
>>> [1,2] |should_not_have| 3
True

Should with true:
>>> ('spec' is not 'SPEC') |should_be| True
True
>>> ('spec' is not 'SPEC') |should_not_be| True
Traceback (most recent call last):
...
ShouldNotSatisfied: True is True

Should with exceptions:
>>> def divide_x_by_y(x, y):
... return x / y

>>> ZeroDivisionError |should_be.thrown_by| (divide_x_by_y, 5, 0)
True
>>> def raise_zerodivisionerror():
... return 1/0
>>> ZeroDivisionError |should_be.thrown_by| raise_zerodivisionerror
True

>>> 'spec' |should_be| 'spec'
True
>>> 'should' |should_not_be| 'SHOULD'
True
Using << and >> instead of | | is also available.

Take a look at doctests folder and you will see everything implemented

Tags

bdd dsl python

In a Nutshell, should-dsl...

MIT License
Permitted

Sub-License

Private Use

Commercial Use

Modify

Distribute

Forbidden

Hold Liable

Required

Include Copyright

Include License

These details are provided for information only. No information here is legal advice and should not be used as such.

All Licenses

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    data presented on the Open Hub is available through our API
  • ...
    in 2016, 47% of companies did not have formal process in place to track OS code
  • ...
    by exploring contributors within projects, you can view details on every commit they have made to that project

Languages

Languages?height=75&width=75
Python
63%
CSS
23%
DOS batch script
6%
2 Other
8%

30 Day Summary

Aug 19 2018 — Sep 18 2018

12 Month Summary

Sep 18 2017 — Sep 18 2018