# Path: alfpy/utils/seqrecords.py
# class SeqRecords:
#     def __init__(self, id_list=None, seq_list=None):
#     def add(self, seqid, seq):
#     def fasta(self, wrap=70):
#     def length_list(self):
#     def __iter__(self):
#     def __len__(self):
#     def __repr__(self):
# def read_fasta(handle):
# def main():
# 
# Path: alfpy/version.py



import hashlib
import os
import subprocess
from alfpy.utils import seqrecords
from alfpy import __version__

def calc_md5(obj):
    return hashlib.md5(str(obj).encode("utf-8")).hexdigest()


def runscript(scriptname, args):
    cmd = [scriptname]
    for arg in args:
        cmd.append(arg)
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE,
                         universal_newlines=True)
    out = "".join(p.communicate())
    return p.returncode, out


class ScriptsCommonTest:
    """Methods testing arguments that are common to all scripts."""

    # the name of the file to read from

    @classmethod
    def set_test_data(cls):
        cls.filename_dna = get_test_data('dna.fa')
        cls.filename_pep = get_test_data('pep.fa')

    def test_arg_version(self):
        cmd = ['--version']
        return_code, out = runscript(self.script_name, cmd)
        self.assertEqual(return_code, 0)

# Path: alfpy/utils/seqrecords.py
# class SeqRecords:
#     def __init__(self, id_list=None, seq_list=None):
#     def add(self, seqid, seq):
#     def fasta(self, wrap=70):
#     def length_list(self):
#     def __iter__(self):
#     def __len__(self):
#     def __repr__(self):
# def read_fasta(handle):
# def main():
# 
# Path: alfpy/version.py



# Path: tests/utils.py
import hashlib
import os
import subprocess
from alfpy.utils import seqrecords
from alfpy import __version__


def calc_md5(obj):
    return hashlib.md5(str(obj).encode("utf-8")).hexdigest()


def runscript(scriptname, args):
    cmd = [scriptname]
    for arg in args:
        cmd.append(arg)
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE,
                         universal_newlines=True)
    out = "".join(p.communicate())
    return p.returncode, out


class ScriptsCommonTest:
    """Methods testing arguments that are common to all scripts."""

    # the name of the file to read from

    @classmethod
    def set_test_data(cls):
        cls.filename_dna = get_test_data('dna.fa')
        cls.filename_pep = get_test_data('pep.fa')

    def test_arg_version(self):
        cmd = ['--version']
        return_code, out = runscript(self.script_name, cmd)
        self.assertEqual(return_code, 0)

        self.assertIn(__version__, out)