| 1 |
|
| 2 |
|
| 3 |
""" |
| 4 |
Test fix of bug described in GitHub Issue #134. |
| 5 |
""" |
| 6 |
|
| 7 |
from sure import expect |
| 8 |
from six import PY2 |
| 9 |
|
| 10 |
|
| 11 |
def test_issue_132(): |
| 12 |
"Correctly handle {} characters in matcher string" |
| 13 |
|
| 14 |
def __great_test(): |
| 15 |
expect('hello%world').should.be.equal('hello%other') |
| 16 |
|
| 17 |
expect(__great_test).when.called.to.throw(AssertionError, "X is 'hello%world' whereas Y is 'hello%other'") |
| 18 |
|
| 19 |
def __great_test_2(): |
| 20 |
expect('hello{42}world').should.be.equal('hello{42}foo') |
| 21 |
|
| 22 |
expect(__great_test_2).when.called.to.throw(AssertionError, "X is 'hello{42}world' whereas Y is 'hello{42}foo'") |
| 23 |
|
| 24 |
def __great_test_3(): |
| 25 |
expect('hello{42world }').should.be.equal('hello{42foo }') |
| 26 |
|
| 27 |
expect(__great_test_3).when.called.to.throw(AssertionError, "X is 'hello{42world }' whereas Y is 'hello{42foo }'") |
| 28 |
|
| 29 |
def __great_test_4(): |
| 30 |
expect('hello{42world }}').should.be.equal('hello{42foo }}') |
| 31 |
|
| 32 |
expect(__great_test_4).when.called.to.throw(AssertionError, "X is 'hello{42world }}' whereas Y is 'hello{42foo }}'") |
| 33 |
|
| 34 |
def __great_test_bytes(): |
| 35 |
expect(b'hello{42world }}').should.be.equal(b'hello{42foo }}') |
| 36 |
|
| 37 |
if PY2: |
| 38 |
error_msg = "X is 'hello{42world }}' whereas Y is 'hello{42foo }}'" |
| 39 |
else: |
| 40 |
error_msg = "X is b'hello{42world }}' whereas Y is b'hello{42foo }}'" |
| 41 |
|
| 42 |
expect(__great_test_bytes).when.called.to.throw(AssertionError, error_msg) |
| 43 |
|
| 44 |
def __great_test_unicode(): |
| 45 |
expect(u'hello{42world }}').should.be.equal(u'hello{42foo }}') |
| 46 |
|
| 47 |
if PY2: |
| 48 |
error_msg = "X is u'hello{42world }}' whereas Y is u'hello{42foo }}'" |
| 49 |
else: |
| 50 |
error_msg = "X is 'hello{42world }}' whereas Y is 'hello{42foo }}'" |
| 51 |
|
| 52 |
expect(__great_test_unicode).when.called.to.throw(AssertionError, error_msg) |