0
I Use This!
Inactive
Analyzed about 22 hours ago. based on code collected about 22 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

Commercial Use

Modify

Distribute

Private Use

Sub-License

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
  • ...
    search using multiple tags to find exactly what you need
  • ...
    in 2016, 47% of companies did not have formal process in place to track OS code
  • ...
    you can subscribe to e-mail newsletters to receive update from the Open Hub blog

Languages

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

30 Day Summary

Oct 21 2018 — Nov 20 2018

12 Month Summary

Nov 20 2017 — Nov 20 2018