<commit_before>__author__ = '<EMAIL>'

import unittest
import zipfile
import os.path as op
import os
import shutil

from mzos.database_finder import DatabaseSearch
from mzos.feature import Peakel


class TestDatabaseSearch(unittest.TestCase):

    def setUp(self):
        z = zipfile.ZipFile(op.normcase('mzos/ressources/hmdb.zip'))
        self.hmdb_path = z.extract('hmdb.sqlite')
        print("Moving extracted archive...")
        shutil.move(self.hmdb_path, 'mzos/ressources/hmdb.sqlite')
        print("Done")

    def tearDown(self):
        print("removing 'hmdb.sqlite'...")
        try:
            os.remove(op.normcase('mzos/ressources/hmdb.sqlite'))
            print("Done")
        except OSError:
            pass

    def test_database_search(self):
        mass_fruc_6p = 260.029718526
        name = "Fructose 6-phosphate"
        peakel = Peakel(mass_fruc_6p - 1.007276, 0.0, 0.0, 0.0)
        peakel.charge = 1
        peakel.polarity = -1
        peakels = [peakel]<commit_msg>add tests<commit_after>__author__ = '<EMAIL>'

import unittest
import zipfile
import os.path as op
import os
import shutil

from mzos.database_finder import DatabaseSearch
from mzos.feature import Peakel


class TestDatabaseSearch(unittest.TestCase):

    def setUp(self):
        z = zipfile.ZipFile(op.abspath('mzos/ressources/hmdb.zip'))
        self.hmdb_path = z.extract('hmdb.sqlite')
        print("Moving extracted archive...")
        shutil.move(self.hmdb_path, 'mzos/ressources/hmdb.sqlite')
        print("Done")

    def tearDown(self):
        print("removing 'hmdb.sqlite'...")
        try:
            os.remove(op.normcase('mzos/ressources/hmdb.sqlite'))
            print("Done")
        except OSError:
            pass

    def test_database_search(self):
        mass_fruc_6p = 260.029718526
        name = "<NAME>-phosphate"
        peakel = Peakel(mass_fruc_6p - 1.007276, 0.0, 0.0, 0.0)
        peakel.charge = 1
        peakel.polarity = -1
        peakels = [peakel]
{'fraction_non_alphanumeric': 0.11841445057701956, 'fraction_numerical': 0.02960361264425489, 'mean_word_length': 2.554367201426025, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '7371899', 'n_tokens_mistral': 747, 'n_tokens_neox': 665, 'n_words': 129}