# Path: solvebio/test/helper.py
# class SolveBioTestCase(unittest.TestCase):
#     TEST_DATASET_FULL_PATH = 'solvebio:public:/HGNC/3.3.0-2020-10-29/HGNC'
#     TEST_DATASET_FULL_PATH_2 = 'solvebio:public:/ClinVar/5.1.0-20200720/Variants-GRCH38'
#     TEST_FILE_FULL_PATH = 'solvebio:public:/HGNC/3.3.0-2020-10-29/hgnc_1000_rows.txt'
# 
#     def setUp(self):
#         super(SolveBioTestCase, self).setUp()
#         api_key = os.environ.get('SOLVEBIO_API_KEY', None)
#         api_host = os.environ.get('SOLVEBIO_API_HOST', None)
#         self.client = solvebio.SolveClient(host=api_host, token=api_key)
# 
#     def check_response(self, response, expect, msg):
#         subset = [(key, response[key]) for
#                   key in [x[0] for x in expect]]
#         self.assertEqual(subset, expect)
# 
#     # Python < 2.7 compatibility
#     def assertRaisesRegexp(self, exception, regexp, callable, *args, **kwargs):
#         try:
#             callable(*args, **kwargs)
#         except exception as err:
#             if regexp is None:
#                 return True
# 
#             if isinstance(regexp, six.string_types):
#                 regexp = re.compile(regexp)
#             if not regexp.search(str(err)):
#                 raise self.failureException('\'%s\' does not match \'%s\'' %
#                                             (regexp.pattern, str(err)))
#         else:
#             raise self.failureException(
#                 '%s was not raised' % (exception.__name__,))
# 
# Path: solvebio/utils/files.py
# def check_gzip_path(file_path):
#     """Check if we have a gzipped file path"""
#     _, ftype = mimetypes.guess_type(file_path)
#     return ftype == 'gzip'


import os
from .helper import SolveBioTestCase
from solvebio.utils.files import check_gzip_path
from __future__ import absolute_import



class GzipTest(SolveBioTestCase):

    def test_gzip_file(self):
        path = os.path.join(os.path.dirname(__file__), "data")
        for yes_gzip in ['some_export.json.gz',
                         'sample.vcf.gz']:
            path = os.path.join(path, yes_gzip)
            self.assertTrue(check_gzip_path(path), path)

        for non_gzip in ['sample2.vcf',
                         'test_export.json',
                         'test_export.csv',
                         'test_export.xlsx']:
            path = os.path.join(path, non_gzip)

# Path: solvebio/test/helper.py
# class SolveBioTestCase(unittest.TestCase):
#     TEST_DATASET_FULL_PATH = 'solvebio:public:/HGNC/3.3.0-2020-10-29/HGNC'
#     TEST_DATASET_FULL_PATH_2 = 'solvebio:public:/ClinVar/5.1.0-20200720/Variants-GRCH38'
#     TEST_FILE_FULL_PATH = 'solvebio:public:/HGNC/3.3.0-2020-10-29/hgnc_1000_rows.txt'
# 
#     def setUp(self):
#         super(SolveBioTestCase, self).setUp()
#         api_key = os.environ.get('SOLVEBIO_API_KEY', None)
#         api_host = os.environ.get('SOLVEBIO_API_HOST', None)
#         self.client = solvebio.SolveClient(host=api_host, token=api_key)
# 
#     def check_response(self, response, expect, msg):
#         subset = [(key, response[key]) for
#                   key in [x[0] for x in expect]]
#         self.assertEqual(subset, expect)
# 
#     # Python < 2.7 compatibility
#     def assertRaisesRegexp(self, exception, regexp, callable, *args, **kwargs):
#         try:
#             callable(*args, **kwargs)
#         except exception as err:
#             if regexp is None:
#                 return True
# 
#             if isinstance(regexp, six.string_types):
#                 regexp = re.compile(regexp)
#             if not regexp.search(str(err)):
#                 raise self.failureException('\'%s\' does not match \'%s\'' %
#                                             (regexp.pattern, str(err)))
#         else:
#             raise self.failureException(
#                 '%s was not raised' % (exception.__name__,))
# 
# Path: solvebio/utils/files.py
# def check_gzip_path(file_path):
#     """Check if we have a gzipped file path"""
#     _, ftype = mimetypes.guess_type(file_path)
#     return ftype == 'gzip'


# Path: solvebio/test/test_utils.py
import os
from .helper import SolveBioTestCase
from solvebio.utils.files import check_gzip_path

from __future__ import absolute_import



class GzipTest(SolveBioTestCase):

    def test_gzip_file(self):
        path = os.path.join(os.path.dirname(__file__), "data")
        for yes_gzip in ['some_export.json.gz',
                         'sample.vcf.gz']:
            path = os.path.join(path, yes_gzip)
            self.assertTrue(check_gzip_path(path), path)

        for non_gzip in ['sample2.vcf',
                         'test_export.json',
                         'test_export.csv',
                         'test_export.xlsx']:
            path = os.path.join(path, non_gzip)

            self.assertFalse(check_gzip_path(path), path)