Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ install:
- pip install coveralls
- pip install -r requirements.txt
python:
- "2.6"
- "2.7"
- "3.5"
- "3.6"
Expand Down
3 changes: 3 additions & 0 deletions robber/expect.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def __init__(self, obj):
self.not_to_flag = False
self.__setup_chaining()

def __repr__(self):
return str(isinstance(self, expect))

@classmethod
def fail_with(cls, message):
cls.message = message
Expand Down
3 changes: 2 additions & 1 deletion robber/matchers/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from robber.bad_expectation import BadExpectation
from robber.expect import expect


class Base:
Expand All @@ -23,7 +24,7 @@ def fail_with(self, message):

def match(self):
if self.matches() is not self.is_negative:
return True
return expect(self.actual)

message = self.message or self.explanation.message
raise BadExpectation(message)
Expand Down
6 changes: 3 additions & 3 deletions tests/matchers/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class TestBase(unittest.TestCase):
def test_it_stores_actual_and_expected(self):
base = Base('actual', 'expected')

expect(base.actual) == 'actual'
expect(base.expected) == 'expected'
expect(base.actual).to.eq('actual')
expect(base.expected).to.eq('expected')

def test_it_calls_matches(self):
matcher = TestWillMatch('actual', 'expected')
Expand All @@ -36,4 +36,4 @@ def test_negative_message(self):

def test_match(self):
matcher = TestWillMatch('actual', 'expected')
expect(matcher.match()).to.eq(True)
expect(matcher.match()).to.eq('actual')
3 changes: 3 additions & 0 deletions tests/test_expect.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def test_chaining(self):
expectation = expect(object)
expect(expectation.to).to.equal(expectation.to.be)

def test_chaining_readme(self):
expect(1 + 1).to.be.an.integer().to.be.within(1, 3)

def test_multiple_not_to_success(self):
expect(1).eq(1)
expect(1).not_to.not_to.eq(1)
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[tox]
envlist = py26,py27,py34,py35,py36
envlist = py27,py34,py35,py36
[testenv]
basepython =
py26: python2.6
py27: python2.7
py34: python3.4
py35: python3.5
Expand Down