<commit_before><commit_msg>moved flask directory to rest<commit_after>import unittest
from datanator.rest.query import front_end_query
import tempfile
import shutil

class TestQueryFrontEnd(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.cache_dirname = tempfile.mkdtemp()
        cls.src = front_end_query.QueryFrontEnd()

    @classmethod
    def tearDownClass(cls):
        shutil.rmtree(cls.cache_dirname)

    @unittest.skip('passed')
    def test_string_query(self):
        string = '2-Ketobutyric acid (alpha ketobutyric acid)'
        results = self.src.string_query(string)
        self.assertEqual(results[0]['m2m_id'], 'M2MDB001633')

    @unittest.skip('passed')
    def test_inchi_query_metabolite(self):
    	inchi = 'InChI=1S/C3H8O10P2/c4-3(5)2(13-15(9,10)11)1-12-14(6,7)8'
    	results = self.src.inchi_query_metabolite(inchi)
    	self.assertEqual(results[0]['m2m_id'], 'M2MDB000326')
    	self.assertEqual(results[1]['ymdb_id'], 'YMDB00671')

    def test_inchi_query_organism(self):
    	inchi = 'InChI=1S/C3H8O10P2/c4-3(5)2(13-15(9,10)11)1-12-14(6,7)8'
    	organism = 'Candidatus Pacearchaeota archaeon'
    	results = self.src.inchi_query_organism(inchi, organism)
    	self.assertEqual(results[0]['m2m_id'], 'M2MDB000326')
    	self.assertEqual(results[0]['taxon_distance'], -1)
{'fraction_non_alphanumeric': 0.1346877351392024, 'fraction_numerical': 0.06772009029345373, 'mean_word_length': 4.40650406504065, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6189184', 'n_tokens_mistral': 554, 'n_tokens_neox': 514, 'n_words': 66}