<commit_before>import pytest
import os
import numpy as np
from astropy import units as u
import matplotlib.pyplot as plt
from matplotlib.testing.compare import compare_images
from matplotlib.patches import Circle
from matplotlib import rc_context
from astropy.wcs import WCS
from astropy.io import fits
from wcsaxes import WCSAxes
from matplotlib import cbook
from astropy.tests.helper import pytest
from astropy.utils.data import download_file
from astropy.tests.helper import remote_data
from wcsaxes import datasets


class TestImages(object):

    @classmethod
    def setup_class(cls):
        cls._filedir = os.path.abspath(__file__)
        cls._basedir = os.path.split(cls._filedir)[0]
        cls._baseline_images_dir = os.path.join(cls._basedir, 'baseline_images')
        cls._result_dir = os.path.abspath(os.path.join(cls._basedir, 'test_result_images'))

        if not os.path.exists(cls._result_dir):
            cbook.mkdirs(cls._result_dir)

        if not os.path.exists(cls._baseline_images_dir):
            cbook.mkdirs(cls._baseline_images_dir)

        cls._tolerance = 1

        cls._image1_hdu = datasets.msx_hdu()
        cls._image2_hdu = datasets.rosat_hdu()
        cls._image3_hdu = datasets.twoMASS_k_hdu()
        cls._cube_hdu = datasets.l1448_co_hdu(cache=False)

    # method to create baseline or test images
    def generate_or_test(self, generate, figure, image, test_image=None, baseline_image=None):
        baseline_image = os.path.abspath(os.path.join(self._baseline_images_dir, image))
        test_image = os.path.abspath(os.path.join(self._result_dir, image))
        if generate:
            figure.savefig(baseline_image)
            pytest.skip("Skipping test, since generating data")
        else:
            figure.savefig(test_image)
            msg = compare_images(baseline_image, test_image, tol=self._tolerance)
            assert msg is None

    # Test for plotting image and also setting values of ticks<commit_msg>forgot to remove cache=False in one place<commit_after>import pytest
import os
import numpy as np
from astropy import units as u
import matplotlib.pyplot as plt
from matplotlib.testing.compare import compare_images
from matplotlib.patches import Circle
from matplotlib import rc_context
from astropy.wcs import WCS
from astropy.io import fits
from wcsaxes import WCSAxes
from matplotlib import cbook
from astropy.tests.helper import pytest
from astropy.utils.data import download_file
from astropy.tests.helper import remote_data
from wcsaxes import datasets


class TestImages(object):

    @classmethod
    def setup_class(cls):
        cls._filedir = os.path.abspath(__file__)
        cls._basedir = os.path.split(cls._filedir)[0]
        cls._baseline_images_dir = os.path.join(cls._basedir, 'baseline_images')
        cls._result_dir = os.path.abspath(os.path.join(cls._basedir, 'test_result_images'))

        if not os.path.exists(cls._result_dir):
            cbook.mkdirs(cls._result_dir)

        if not os.path.exists(cls._baseline_images_dir):
            cbook.mkdirs(cls._baseline_images_dir)

        cls._tolerance = 1

        cls._image1_hdu = datasets.msx_hdu()
        cls._image2_hdu = datasets.rosat_hdu()
        cls._image3_hdu = datasets.twoMASS_k_hdu()
        cls._cube_hdu = datasets.l1448_co_hdu()

    # method to create baseline or test images
    def generate_or_test(self, generate, figure, image, test_image=None, baseline_image=None):
        baseline_image = os.path.abspath(os.path.join(self._baseline_images_dir, image))
        test_image = os.path.abspath(os.path.join(self._result_dir, image))
        if generate:
            figure.savefig(baseline_image)
            pytest.skip("Skipping test, since generating data")
        else:
            figure.savefig(test_image)
            msg = compare_images(baseline_image, test_image, tol=self._tolerance)
            assert msg is None

    # Test for plotting image and also setting values of ticks
{'fraction_non_alphanumeric': 0.08016133098058986, 'fraction_numerical': 0.004537433829089992, 'mean_word_length': 3.3652365236523654, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '789810', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1227, 'n_words': 291}