# Path: ensembler/utils.py
# def get_installed_resource_filename(relative_path):
#     """
#     Returns the installation path of a resource file shipped with the code.
# 
#     Parameters
#     ----------
#     name: str
#         Name of the file to load (relative to the `ensembler` main code directory).
# 
#     Returns
#     -------
#     installed_filepath: str
#         absolute path of the installed file
# 
#     Examples
#     --------
#     >>> pathname = get_installed_resource_filename('tests/example_project/meta0.yaml')
#     """
#     installed_filepath = resource_filename(ensembler.__name__, relative_path)
# 
#     if not os.path.exists(installed_filepath):
#         raise ValueError(
#             "Sorry! {0} does not exist."
#             "If you just added it, you'll have to re-install".format(relative_path)
#         )
# 
#     return installed_filepath


import sys
import os
import ensembler.pdb
    from io import StringIO
    from StringIO import StringIO
from ensembler.utils import get_installed_resource_filename
from mock import Mock
from numpy import arange
from nose.plugins.attrib import attr
if sys.version_info > (3, 0):
else:


@attr('unit')
def test_extract_residues_by_resnum_from_4CFE():
    # 4CFE contains a 'TPO' residue
    pdb_input_filepath = get_installed_resource_filename(os.path.join('tests', 'resources', '4CFE.pdb.gz'))
    template = Mock()
    template.chainid= 'A'
    template.resolved_pdbresnums = [str(x) for x in arange(16, 269)]
    ofile = StringIO()
    ensembler.pdb.extract_residues_by_resnum(ofile, pdb_input_filepath, template)
    ofile.close()


@attr('unit')
def test_extract_residues_by_resnum_from_3HLL():
    # 3HLL contains resnums '56A' and '93B'

# Path: ensembler/utils.py
# def get_installed_resource_filename(relative_path):
#     """
#     Returns the installation path of a resource file shipped with the code.
# 
#     Parameters
#     ----------
#     name: str
#         Name of the file to load (relative to the `ensembler` main code directory).
# 
#     Returns
#     -------
#     installed_filepath: str
#         absolute path of the installed file
# 
#     Examples
#     --------
#     >>> pathname = get_installed_resource_filename('tests/example_project/meta0.yaml')
#     """
#     installed_filepath = resource_filename(ensembler.__name__, relative_path)
# 
#     if not os.path.exists(installed_filepath):
#         raise ValueError(
#             "Sorry! {0} does not exist."
#             "If you just added it, you'll have to re-install".format(relative_path)
#         )
# 
#     return installed_filepath


# Path: ensembler/tests/test_gather_templates.py
import sys
import os
import ensembler.pdb
    from io import StringIO
    from StringIO import StringIO
from ensembler.utils import get_installed_resource_filename
from mock import Mock
from numpy import arange
from nose.plugins.attrib import attr

if sys.version_info > (3, 0):
else:


@attr('unit')
def test_extract_residues_by_resnum_from_4CFE():
    # 4CFE contains a 'TPO' residue
    pdb_input_filepath = get_installed_resource_filename(os.path.join('tests', 'resources', '4CFE.pdb.gz'))
    template = Mock()
    template.chainid= 'A'
    template.resolved_pdbresnums = [str(x) for x in arange(16, 269)]
    ofile = StringIO()
    ensembler.pdb.extract_residues_by_resnum(ofile, pdb_input_filepath, template)
    ofile.close()


@attr('unit')
def test_extract_residues_by_resnum_from_3HLL():
    # 3HLL contains resnums '56A' and '93B'

    pdb_input_filepath = get_installed_resource_filename(os.path.join('tests', 'resources', '3HLL.pdb.gz'))