robber.py icon indicating copy to clipboard operation
robber.py copied to clipboard

equal not work properly when compare str with unicode

Open tiger-flying opened this issue 8 years ago • 2 comments

The following code snippet demonstrates the issue(run on OSX):

from robber import expect
import json
abc=json.loads('{"a": "abc"}')

expect(abc['a']).to.equal('abc')

Run the above will generate the following exception message:

BadExpectation: u'Expected "abc" to be "abc"'

If I replace equal to eq(namely, expect(abc['a']).to.eq('abc')), then it works

tiger-flying avatar Apr 14 '16 04:04 tiger-flying

Sorry, forgot to mention that I'm using python 2.7

tiger-flying avatar Apr 14 '16 04:04 tiger-flying

@tiger-flying Actually, the right expectation should be:

expect(abc['a']).to.eq('abc')

equal just use for checking identical

hieueastagile avatar Feb 08 '17 10:02 hieueastagile