# Path: deepanimebot/classifiers.py
# def fetch_cvimage_from_url(url, maxsize=10 * 1024 * 1024):
#     def classify(self, *args, **kwargs):
#     def __init__(self, dataset_path, input_shape, model_name='model'):
#     def classify(self, cvimage):
#     def __init__(self, image_classifier):
#     def classify(self, url=None):
#     def __init__(self, base_url):
#     def classify(self, **params):
# class MockClassifier(object):
# class ImageClassifier(object):
# class URLClassifier(object):
# class RemoteClassifier(object):
# 
# Path: deepanimebot/exceptions.py
# class NotImage(Exception): pass
# class RemoteError(Exception): pass


import os
import time
import json
import h5py
import cv2
import pytest
import requests
import six
import deploy
import data
import mocks
from multiprocessing import TimeoutError
from deepanimebot import classifiers
from deepanimebot import exceptions as exc
# -*- coding: utf-8 -*-




TEST_IMAGE_PATH = os.path.join(os.path.dirname(__file__), 'fixtures', '1920x1080.png')


def test_fetch_cvimage_from_url(monkeypatch):
    with open(TEST_IMAGE_PATH, 'rb') as f:
        image = f.read()
    monkeypatch.setattr(requests, 'get', mocks.mock_get(image))
    image = classifiers.fetch_cvimage_from_url('this url is ignored')
    assert image is not None


def test_fetch_cvimage_from_url_non_image(monkeypatch):
    monkeypatch.setattr(requests, 'get', mocks.mock_get('non-image string'))

# Path: deepanimebot/classifiers.py
# def fetch_cvimage_from_url(url, maxsize=10 * 1024 * 1024):
#     def classify(self, *args, **kwargs):
#     def __init__(self, dataset_path, input_shape, model_name='model'):
#     def classify(self, cvimage):
#     def __init__(self, image_classifier):
#     def classify(self, url=None):
#     def __init__(self, base_url):
#     def classify(self, **params):
# class MockClassifier(object):
# class ImageClassifier(object):
# class URLClassifier(object):
# class RemoteClassifier(object):
# 
# Path: deepanimebot/exceptions.py
# class NotImage(Exception): pass
# class RemoteError(Exception): pass


# Path: tests/test_deepanimebot_classifiers.py
import os
import time
import json
import h5py
import cv2
import pytest
import requests
import six
import deploy
import data
import mocks
from multiprocessing import TimeoutError
from deepanimebot import classifiers
from deepanimebot import exceptions as exc

# -*- coding: utf-8 -*-




TEST_IMAGE_PATH = os.path.join(os.path.dirname(__file__), 'fixtures', '1920x1080.png')


def test_fetch_cvimage_from_url(monkeypatch):
    with open(TEST_IMAGE_PATH, 'rb') as f:
        image = f.read()
    monkeypatch.setattr(requests, 'get', mocks.mock_get(image))
    image = classifiers.fetch_cvimage_from_url('this url is ignored')
    assert image is not None


def test_fetch_cvimage_from_url_non_image(monkeypatch):
    monkeypatch.setattr(requests, 'get', mocks.mock_get('non-image string'))

    image = classifiers.fetch_cvimage_from_url('this url is ignored')