<commit_before>"""
BaseMap tests

Example usage:

  `python2.7 -m unittest tests.data.test_basemap`
  
  or
  
  `python2.7 -m unittest tests.data.test_basemap`
"""
#pylint: disable=C0103,R0904

import unittest
import sunpy
import pyfits

class TestBaseMap(unittest.TestCase):
    """Tests the BaseMap class"""
    def setUp(self):
        self.file = 'doc/sample-data/AIA20110319_105400_0171.fits'
        self.map = sunpy.Map(self.file) 

    def tearDown(self):
        self.map = None

    def test_fits_data_comparison(self):
        """Make sure the data is the same in pyfits and SunPy"""
        fits = pyfits.open(self.file)
        self.assertEqual(self.map.tolist(), fits[0].data.tolist(),
                         'data not preserved')
    def test_fits_header_comparison(self):
        """Make sure the header is the same in pyfits and SunPy"""
        fits = pyfits.open(self.file)
        
        # Access fits data once to apply scaling-related changes and update
        # header information in fits[0].header
        fits[0].data #pylint: disable=W0104

        self.assertEqual(list(self.map.header.keys()), list(fits[0].header.keys()),
                         'header not preserved')<commit_msg>Fixed an issue which caused unit test comparing Map and pyfits data to take a long time.<commit_after>"""
BaseMap tests

Example usage:

  `python2.7 -m unittest tests.data.test_basemap`
  
  or
  
  `python2.7 -m unittest tests.data.test_basemap`
"""
#pylint: disable=C0103,R0904

import unittest
import sunpy
import pyfits

class TestBaseMap(unittest.TestCase):
    """Tests the BaseMap class"""
    def setUp(self):
        self.file = 'doc/sample-data/AIA20110319_105400_0171.fits'
        self.map = sunpy.Map(self.file) 

    def tearDown(self):
        self.map = None

    def test_fits_data_comparison(self):
        """Make sure the data is the same in pyfits and SunPy"""
        fits = pyfits.open(self.file)
        self.assertTrue((self.map == fits[0].data).all(), 'data not preserved')
    def test_fits_header_comparison(self):
        """Make sure the header is the same in pyfits and SunPy"""
        fits = pyfits.open(self.file)
        
        # Access fits data once to apply scaling-related changes and update
        # header information in fits[0].header
        fits[0].data #pylint: disable=W0104

        self.assertEqual(list(self.map.header.keys()), list(fits[0].header.keys()),
                         'header not preserved')
{'fraction_non_alphanumeric': 0.1111111111111111, 'fraction_numerical': 0.030707070707070707, 'mean_word_length': 2.7572078907435507, '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': '7198117', 'n_tokens_mistral': 830, 'n_tokens_neox': 766, 'n_words': 205}