<commit_before>"""Test cases for SDO Map subclasses"""

from sunpy.map.sources.sdo import HMIMap
from sunpy.map.sources.sdo import AIAMap
from sunpy.map import Map
from sunpy.net import HelioviewerClient
import pytest

@pytest.fixture
def createHMI():
    hv = HelioviewerClient()
    filepath = hv.download_jp2('2012/07/05 00:30:00', observatory='SDO', instrument='HMI', detector='HMI', measurement='continuum')
    return filepath

def test_is_datasource_for(createHMI):
    hmi = Map(createHMI)
    header = dict(hmi.meta)
    assert (hmi.is_datasource_for(hmi.data, header) == True)

def test_observatory(createHMI):
    hmi = Map(createHMI)
    assert(hmi.observatory == "SDO")

def test_measurement(createHMI):
    hmi = Map(createHMI)
    assert(hmi.measurement == "continuum")
    <commit_msg>Added some AIA tests. 1. Marked createHMI as online because of hv.download_jp2(). 2. Created AIA tests in a similar vein to HMI. 3. AIA object is available in sunpy module as AIA_171_IMAGE, so used it.<commit_after>"""Test cases for SDO Map subclasses"""

from sunpy.map.sources.sdo import HMIMap
from sunpy.map.sources.sdo import AIAMap
from sunpy.map import Map
from sunpy.net import HelioviewerClient
from sunpy import AIA_171_IMAGE as aiaimg
import pytest

@pytest.mark.online
@pytest.fixture
def createHMI():
    """Downloads a HMIMap jp2 object through the use of HelioviewerClient."""
    hv = HelioviewerClient()
    filepath = hv.download_jp2('2012/07/05 00:30:00', observatory='SDO', instrument='HMI', detector='HMI', measurement='continuum')
    return filepath

@pytest.fixture
def createAIAMap():
    """Creates an AIAMap as given in documentation examples, through AIA_171_IMAGE."""
    aia = Map(aiaimg)
    return aia

# HMI Tests
def test_is_datasource_for(createHMI):
    hmi = Map(createHMI)
    header = dict(hmi.meta)
    assert (hmi.is_datasource_for(hmi.data, header) == True)

def test_observatory(createHMI):
    hmi = Map(createHMI)
    assert(hmi.observatory == "SDO")

def test_measurement(createHMI):
    hmi = Map(createHMI)
    assert (hmi.measurement == "continuum")

# AIA Tests
def test_is_datasource_for(createAIAMap):
    header = dict(createAIAMap.meta)
    assert (createAIAMap.is_datasource_for(createAIAMap.data, header) == True)

def test_observatory(createAIAMap):
    assert (createAIAMap.observatory == "SDO")

def test_measurement(createAIAMap):
    assert (createAIAMap.measurement == 171)
{'fraction_non_alphanumeric': 0.1087848932676519, 'fraction_numerical': 0.01929392446633826, 'mean_word_length': 4.830143540669856, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4023375', 'n_tokens_mistral': 895, 'n_tokens_neox': 862, 'n_words': 211}