EastAgile / robber.py

BDD / TDD assertion library for Python
MIT License
8 stars 1 forks source link

[f] Unicode comparison #54

Closed catriuspham closed 7 years ago

catriuspham commented 7 years ago

Related issue

https://github.com/EastAgile/robber.py/issues/12

Description

Now users can use compare a normal string to a unicode string. We also support comparing multi-level dicts and lists that contain unicode strings.

Usage

# unicode string
expect(u'Mèo').to.eq('Mèo')
# unicode list
expect([u'Mèo', u'Chó']).to.eq(['Mèo', 'Chó'])
# unicode list in list
expect([[u'Mèo'], [u'Chó']]).to.eq([['Mèo'], ['Chó']])
# unicode dict
expect({
    'cat': u'Mèo',
    'dog': u'Chó',
}).to.eq({
    'cat': 'Mèo',
    'dog': 'Chó',
})
# unicode dict in dict
expect({
    'd1': {'cat': u'Mèo'},
    'd2': {'dog': u'Chó'},
}).to.eq({
    'd1': {'cat': 'Mèo'},
    'd2': {'dog': 'Chó'},
})
# unicode list in dict
expect({
    'd1': [u'Mèo', u'Chó'],
    'd2': [u'Mèo', u'Chó'],
}).to.eq({
    'd1': ['Mèo', 'Chó'],
    'd2': ['Mèo', 'Chó'],
})
# unicode dict in list
expect(
    [{'cat': u'Mèo', 'dog': u'Chó'}, {'cat': u'Mèo', 'dog': u'Chó'}]
).to.eq(
    [{'cat': 'Mèo', 'dog': 'Chó'}, {'cat': 'Mèo', 'dog': 'Chó'}]
)
coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 4e921908f370f473e48e0dc18e467d46603734ad on feature/unicode-comparison into 85ce13ae06cc6f8c908bcd58fd71b928d2249176 on master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 4e921908f370f473e48e0dc18e467d46603734ad on feature/unicode-comparison into 85ce13ae06cc6f8c908bcd58fd71b928d2249176 on master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling b5562db341a08568cea031e97a3bc1fbafce2eb8 on feature/unicode-comparison into 85ce13ae06cc6f8c908bcd58fd71b928d2249176 on master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling b5562db341a08568cea031e97a3bc1fbafce2eb8 on feature/unicode-comparison into 85ce13ae06cc6f8c908bcd58fd71b928d2249176 on master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 4dc3734194f7e5ee5c3682f25055f3d7537c019e on feature/unicode-comparison into 85ce13ae06cc6f8c908bcd58fd71b928d2249176 on master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 4dc3734194f7e5ee5c3682f25055f3d7537c019e on feature/unicode-comparison into 85ce13ae06cc6f8c908bcd58fd71b928d2249176 on master.

catriuspham commented 7 years ago

@hieueastagile I made some changes, please take a look

hieueastagile commented 7 years ago

Looks good so far, feel free to merge it. I have some idea on improving the codebase, but I guess we can talk later then.

catriuspham commented 7 years ago

@oyster Please help merge this PR, and close https://github.com/EastAgile/robber.py/issues/12, thanks.