# Path: gromacs/formats.py

# 
# Path: tests/datafiles.py
# def datafile(name):
#     return resource_filename(__name__, os.path.join("data", name))


import pytest
import numpy as np
import gromacs.fileformats.xpm
from numpy.testing import assert_almost_equal, assert_equal
from gromacs.formats import XPM
from ..datafiles import datafile
from __future__ import division, absolute_import, print_function





@pytest.fixture
def ssfile():
    return datafile("fileformats/ss.xpm.bz2")

@pytest.fixture
def xpm(ssfile):
    return XPM(filename=ssfile)

@pytest.fixture
def xpm_df(xpm):
    return xpm.to_df()

class TestXPM(object):
    def _run_tests(self, x):
        assert_equal(x.array.shape, (500, 769))
        assert_equal(x.xvalues, np.arange(0, 500))
        assert_equal(x.yvalues, np.arange(1, 770))
        assert_equal((x.array == 'A-Helix').sum(), 292829)

    def test_constructor(self, xpm):
        self._run_tests(xpm)

    def test_read(self, ssfile):

# Path: gromacs/formats.py

# 
# Path: tests/datafiles.py
# def datafile(name):
#     return resource_filename(__name__, os.path.join("data", name))


# Path: tests/fileformats/test_xpm.py
import pytest
import numpy as np
import gromacs.fileformats.xpm
from numpy.testing import assert_almost_equal, assert_equal
from gromacs.formats import XPM
from ..datafiles import datafile

from __future__ import division, absolute_import, print_function





@pytest.fixture
def ssfile():
    return datafile("fileformats/ss.xpm.bz2")

@pytest.fixture
def xpm(ssfile):
    return XPM(filename=ssfile)

@pytest.fixture
def xpm_df(xpm):
    return xpm.to_df()

class TestXPM(object):
    def _run_tests(self, x):
        assert_equal(x.array.shape, (500, 769))
        assert_equal(x.xvalues, np.arange(0, 500))
        assert_equal(x.yvalues, np.arange(1, 770))
        assert_equal((x.array == 'A-Helix').sum(), 292829)

    def test_constructor(self, xpm):
        self._run_tests(xpm)

    def test_read(self, ssfile):

        x = XPM()