# Path: q2_types/distance_matrix/_format.py
# class LSMatFormat(model.TextFileFormat):
#     def sniff(self):
#         sniffer = skbio.io.io_registry.get_sniffer('lsmat')
#         return sniffer(str(self))[0]


import unittest
import skbio
from q2_types.distance_matrix import LSMatFormat
from qiime2.plugin.testing import TestPluginBase
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------





class TestTransformers(TestPluginBase):
    package = 'q2_types.distance_matrix.tests'

    def test_skbio_distance_matrix_to_lsmat_format(self):
        transformer = self.get_transformer(skbio.DistanceMatrix, LSMatFormat)

        filenames = ('distance-matrix-1x1.tsv', 'distance-matrix-2x2.tsv',
                     'distance-matrix-NxN.tsv')
        for filename in filenames:
            input = skbio.DistanceMatrix.read(self.get_data_path(filename))

            obs = transformer(input)
            obs = skbio.DistanceMatrix.read(str(obs))

            exp = input
            self.assertEqual(obs, exp)

    def test_lsmat_format_to_skbio_distance_matrix(self):
        filenames = ('distance-matrix-1x1.tsv', 'distance-matrix-2x2.tsv',
                     'distance-matrix-NxN.tsv')
        for filename in filenames:
            input, obs = self.transform_format(

# Path: q2_types/distance_matrix/_format.py
# class LSMatFormat(model.TextFileFormat):
#     def sniff(self):
#         sniffer = skbio.io.io_registry.get_sniffer('lsmat')
#         return sniffer(str(self))[0]


# Path: q2_types/distance_matrix/tests/test_transformer.py
import unittest
import skbio
from q2_types.distance_matrix import LSMatFormat
from qiime2.plugin.testing import TestPluginBase

#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------





class TestTransformers(TestPluginBase):
    package = 'q2_types.distance_matrix.tests'

    def test_skbio_distance_matrix_to_lsmat_format(self):
        transformer = self.get_transformer(skbio.DistanceMatrix, LSMatFormat)

        filenames = ('distance-matrix-1x1.tsv', 'distance-matrix-2x2.tsv',
                     'distance-matrix-NxN.tsv')
        for filename in filenames:
            input = skbio.DistanceMatrix.read(self.get_data_path(filename))

            obs = transformer(input)
            obs = skbio.DistanceMatrix.read(str(obs))

            exp = input
            self.assertEqual(obs, exp)

    def test_lsmat_format_to_skbio_distance_matrix(self):
        filenames = ('distance-matrix-1x1.tsv', 'distance-matrix-2x2.tsv',
                     'distance-matrix-NxN.tsv')
        for filename in filenames:
            input, obs = self.transform_format(

                LSMatFormat, skbio.DistanceMatrix, filename=filename)