<commit_before># -*- coding: utf-8 -*-

from __future__ import absolute_import

from pmdarima.datasets import load_lynx
from pmdarima.arima import ARIMA

import pytest
import os
import platform

lynx = load_lynx()

# test images directories
travis = os.environ.get("TESTING_ON_TRAVIS", "false").lower() == "true"

# Do not test on travis because they hate MPL
if not travis:

    # base images are created on Mac/Darwin. Windows needs a higher tolerance
    if platform.system() == "Windows":
        tolerance = 10
    else:
        tolerance = 5

    @pytest.mark.parametrize(
        'model_type,model', [
            pytest.param('arma', ARIMA(order=(1, 0, 0))),
            pytest.param('arima', ARIMA(order=(1, 1, 0))),
            pytest.param('sarimax', ARIMA(order=(1, 1, 0),
                                          seasonal_order=(1, 0, 0, 12)))
        ])
    @pytest.mark.mpl_image_compare(tolerance=10)
    def test_plot_diagnostics(model_type, model):
        model.fit(lynx)
        return model.plot_diagnostics(figsize=(15, 12))<commit_msg>actually set image diff tolerance based on OS.<commit_after># -*- coding: utf-8 -*-

from __future__ import absolute_import

from pmdarima.datasets import load_lynx
from pmdarima.arima import ARIMA

import pytest
import os
import platform

lynx = load_lynx()

# test images directories
travis = os.environ.get("TESTING_ON_TRAVIS", "false").lower() == "true"

# Do not test on travis because they hate MPL
if not travis:

    # base images are created on Mac/Darwin. Windows needs a higher tolerance
    if platform.system() == "Windows":
        tolerance = 10
    else:
        tolerance = 5

    @pytest.mark.parametrize(
        'model_type,model', [
            pytest.param('arma', ARIMA(order=(1, 0, 0))),
            pytest.param('arima', ARIMA(order=(1, 1, 0))),
            pytest.param('sarimax', ARIMA(order=(1, 1, 0),
                                          seasonal_order=(1, 0, 0, 12)))
        ])
    @pytest.mark.mpl_image_compare(tolerance=tolerance)
    def test_plot_diagnostics(model_type, model):
        model.fit(lynx)
        return model.plot_diagnostics(figsize=(15, 12))
{'fraction_non_alphanumeric': 0.12094531974050046, 'fraction_numerical': 0.021316033364226137, 'mean_word_length': 2.8077601410934743, 'pattern_counts': {'":': 2, '<': 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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '969830', 'n_tokens_mistral': 742, 'n_tokens_neox': 708, 'n_words': 180}