<commit_before>import imread
from imread.imread import imread_from_blob
import numpy as np
def test_imread_from_blob():
    def compare_with_blob(filename, formatstr):
        from os import path
        filename = path.join(
                        path.dirname(__file__),
                        'data',
                        filename)
        fromfile= imread.imread(filename)
        fromblob = imread_from_blob(open(filename).read(), formatstr)
        assert np.all(fromblob == fromfile)
    yield compare_with_blob, 'good.png', 'png'
    yield compare_with_blob, 'GOOD.PNG', 'png'
    yield compare_with_blob, 'mono.tif', 'tif'
    yield compare_with_blob, 'mono.tif', 'tiff'
    yield compare_with_blob, 'py-installer-indexed.bmp', 'bmp'<commit_msg>TST Fix tests for Python 3<commit_after>import imread
from imread.imread import imread_from_blob
import numpy as np
def test_imread_from_blob():
    def compare_with_blob(filename, formatstr):
        from os import path
        filename = path.join(
                        path.dirname(__file__),
                        'data',
                        filename)
        fromfile= imread.imread(filename)
        fromblob = imread_from_blob(open(filename, 'br').read(), formatstr)
        assert np.all(fromblob == fromfile)
    yield compare_with_blob, 'good.png', 'png'
    yield compare_with_blob, 'GOOD.PNG', 'png'
    yield compare_with_blob, 'mono.tif', 'tif'
    yield compare_with_blob, 'mono.tif', 'tiff'
    yield compare_with_blob, 'py-installer-indexed.bmp', 'bmp'
{'fraction_non_alphanumeric': 0.10214703968770332, 'fraction_numerical': 0.0006506180871828237, 'mean_word_length': 2.723970944309927, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '113770', 'n_tokens_mistral': 487, 'n_tokens_neox': 473, 'n_words': 109}