<filename>tests/test_equality.py<gh_stars>0
# -*- coding: utf-8 -*-

# preggy assertions
# https://github.com/heynemann/preggy

# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2013 <NAME> <EMAIL>

from preggy import expect

#-----------------------------------------------------------------------------

TEST_DATA = (
    'qwe',
    b'qwe',
    b'\xff\xd8\xff\xe0\x00\x10JFIF',
    [1],
    {'a': 'b'},
    tuple([2])
)

UNICODE_TEST_DATA = (
    b'asdqwe123',
    'asdqwe123',
)

UNEQUAL_DATA = (
    'asd',
    [2],
    {'c': 'd'},
    tuple([3])
)

#-----------------------------------------------------------------------------


def is_equal(topic):
    item, expected = topic
    expect(item).to_equal(expected)


def is_not_equal(topic):
    item, expected = topic
    expect(item).Not.to_equal(expected)
    expect(item).not_to_equal(expected)


#-----------------------------------------------------------------------------


def test_unicode_equal():
    is_equal((UNICODE_TEST_DATA[0], UNICODE_TEST_DATA[1]))


def test_equal():
    for item in TEST_DATA:
        yield is_equal, (item, item)


def test_not_equal():
    for item in TEST_DATA:
        for unequal in UNEQUAL_DATA:
            yield is_not_equal, (item, unequal)

<filename>tests/test_equality.py<gh_stars>0
# -*- coding: utf-8 -*-

# preggy assertions
# https://github.com/heynemann/preggy

# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2013 <NAME> <EMAIL>

from preggy import expect

#-----------------------------------------------------------------------------

TEST_DATA = (
    'qwe',
    b'qwe',
    b'\xff\xd8\xff\xe0\x00\x10JFIF',
    [1],
    {'a': 'b'},
    tuple([2])
)

UNICODE_TEST_DATA = (
    b'asdqwe123',
    'asdqwe123',
)

UNEQUAL_DATA = (
    'asd',
    [2],
    {'c': 'd'},
    tuple([3])
)

#-----------------------------------------------------------------------------


def is_equal(topic):
    item, expected = topic
    expect(item).to_equal(expected)


def is_not_equal(topic):
    item, expected = topic
    expect(item).Not.to_equal(expected)
    expect(item).not_to_equal(expected)


#-----------------------------------------------------------------------------


def test_unicode_equal():
    is_equal((UNICODE_TEST_DATA[0], UNICODE_TEST_DATA[1]))


def test_equal():
    for item in TEST_DATA:
        yield is_equal, (item, item)


def test_not_equal():
    for item in TEST_DATA:
        for unequal in UNEQUAL_DATA:
            yield is_not_equal, (item, unequal)

# -*- coding: utf-8 -*- # preggy assertions # https://github.com/heynemann/preggy # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2013 <NAME> <EMAIL> #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- #-----------------------------------------------------------------------------