Skip to content

Commit

Permalink
#5: Added tests for rightshift.breakers.
Browse files Browse the repository at this point in the history
  • Loading branch information
OOPMan committed Mar 2, 2016
1 parent ad81e6f commit 6d35077
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions rightshift/tests/test_breakers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from unittest import TestCase
from hypothesis import given
from hypothesis.strategies import text
from rightshift import identity
from rightshift.matchers import is_instance
from rightshift.breakers import break_if, break_if_not, BreakerException


class BreakersTest(TestCase):

@given(text())
def test_break_if_with_text(self, data):
data_type = type(data)
self.assertRaises(BreakerException, identity >> break_if(is_instance(data_type)), data)


@given(text())
def test_break_if_not_with_text(data):
data_type = type(data)
f = identity >> break_if_not(is_instance(data_type))
assert(f(data), data)

0 comments on commit 6d35077

Please sign in to comment.