# coding=utf-8

from __future__ import unicode_literals

import os

from utils.image_test_case import ImageTestCase
from utils import tmp


class ImageTestCaseTestCase(ImageTestCase):
    def test(self):
        def _path_from_name(name):
            return os.path.join(os.path.dirname(__file__), 'results/' + name)

        def _compare(file1, file2, **kwargs):
            self.assertImageAlmostEqual(_path_from_name(file1), _path_from_name(file2), **kwargs)

        # Compare identical images
        _compare('white.png', 'white.png')
        _compare('red.jpg', 'red.jpg')
        # Compare close images
        _compare('gradient.png', 'gradient-broken.png', threshold=7, diff_file=tmp.get_temp_filename('.png'))

        with self.assertRaises(AssertionError):
            _compare('red.jpg', 'white.png')

        # Compare idendical images, threshold 0%
        file_path = _path_from_name('white.png')
        self.assertImageEqual(file_path, file_path)

9f21834e8bd1f2d4a1c0c31294ad896c83a311ee
<mask token>

<mask token>


class ImageTestCaseTestCase(ImageTestCase):
    <mask token>

<mask token>


class ImageTestCaseTestCase(ImageTestCase):

    def test(self):

        def _path_from_name(name):
            return os.path.join(os.path.dirname(__file__), 'results/' + name)

        def _compare(file1, file2, **kwargs):
            self.assertImageAlmostEqual(_path_from_name(file1),
                _path_from_name(file2), **kwargs)
        _compare('white.png', 'white.png')
        _compare('red.jpg', 'red.jpg')
        _compare('gradient.png', 'gradient-broken.png', threshold=7,
            diff_file=tmp.get_temp_filename('.png'))
        with self.assertRaises(AssertionError):
            _compare('red.jpg', 'white.png')
        file_path = _path_from_name('white.png')
        self.assertImageEqual(file_path, file_path)

from __future__ import unicode_literals
import os
from utils.image_test_case import ImageTestCase
from utils import tmp


class ImageTestCaseTestCase(ImageTestCase):

    def test(self):

        def _path_from_name(name):
            return os.path.join(os.path.dirname(__file__), 'results/' + name)

        def _compare(file1, file2, **kwargs):
            self.assertImageAlmostEqual(_path_from_name(file1),
                _path_from_name(file2), **kwargs)
        _compare('white.png', 'white.png')
        _compare('red.jpg', 'red.jpg')
        _compare('gradient.png', 'gradient-broken.png', threshold=7,
            diff_file=tmp.get_temp_filename('.png'))
        with self.assertRaises(AssertionError):
            _compare('red.jpg', 'white.png')
        file_path = _path_from_name('white.png')
        self.assertImageEqual(file_path, file_path)

# coding=utf-8

from __future__ import unicode_literals

import os

from utils.image_test_case import ImageTestCase
from utils import tmp


class ImageTestCaseTestCase(ImageTestCase):
    def test(self):
        def _path_from_name(name):
            return os.path.join(os.path.dirname(__file__), 'results/' + name)

        def _compare(file1, file2, **kwargs):
            self.assertImageAlmostEqual(_path_from_name(file1), _path_from_name(file2), **kwargs)

        # Compare identical images
        _compare('white.png', 'white.png')
        _compare('red.jpg', 'red.jpg')
        # Compare close images
        _compare('gradient.png', 'gradient-broken.png', threshold=7, diff_file=tmp.get_temp_filename('.png'))

        with self.assertRaises(AssertionError):
            _compare('red.jpg', 'white.png')

        # Compare idendical images, threshold 0%
        file_path = _path_from_name('white.png')
        self.assertImageEqual(file_path, file_path)
