# Path: q2_types/sample_data/_format.py
# class AlphaDiversityFormat(model.TextFileFormat):
#     def _validate_(self, level):


import shutil
import unittest
from q2_types.sample_data import (AlphaDiversityDirectoryFormat,
                                  AlphaDiversityFormat)
from qiime2.plugin.testing import TestPluginBase
from qiime2.plugin import ValidationError
    def test_alpha_diversity_format_validate_positive_one_sample(self):
        filepath = self.get_data_path('alpha-diversity-one-sample.tsv')
        format = AlphaDiversityFormat(filepath, mode='r')

        # Should succeed
        format.validate()

    def test_alpha_diversity_format_validate_positive_md_columns(self):
        filepath = self.get_data_path('alpha-diversity-with-metadata.tsv')
        format = AlphaDiversityFormat(filepath, mode='r')

        # Should succeed
        format.validate()

    def test_alpha_diversity_format_validate_negative_no_records(self):
        filepath = self.get_data_path('alpha-diversity-missing-records.tsv')
        format = AlphaDiversityFormat(filepath, mode='r')

        with self.assertRaisesRegex(ValidationError, 'No records found'):
            format.validate()

    def test_alpha_diversity_format_validate_negative_too_few_cols(self):
        filepath = self.get_data_path('alpha-diversity-one-column.tsv')
        format = AlphaDiversityFormat(filepath, mode='r')

        with self.assertRaisesRegex(ValidationError, 'line 1.*2 columns'):
            format.validate()

    def test_alpha_diversity_format_validate_negative_jagged_rows(self):
        filepath = self.get_data_path('alpha-diversity-jagged-rows.tsv')

# Path: q2_types/sample_data/_format.py
# class AlphaDiversityFormat(model.TextFileFormat):
#     def _validate_(self, level):


# Path: q2_types/sample_data/tests/test_format.py
import shutil
import unittest
from q2_types.sample_data import (AlphaDiversityDirectoryFormat,
                                  AlphaDiversityFormat)
from qiime2.plugin.testing import TestPluginBase
from qiime2.plugin import ValidationError

    def test_alpha_diversity_format_validate_positive_one_sample(self):
        filepath = self.get_data_path('alpha-diversity-one-sample.tsv')
        format = AlphaDiversityFormat(filepath, mode='r')

        # Should succeed
        format.validate()

    def test_alpha_diversity_format_validate_positive_md_columns(self):
        filepath = self.get_data_path('alpha-diversity-with-metadata.tsv')
        format = AlphaDiversityFormat(filepath, mode='r')

        # Should succeed
        format.validate()

    def test_alpha_diversity_format_validate_negative_no_records(self):
        filepath = self.get_data_path('alpha-diversity-missing-records.tsv')
        format = AlphaDiversityFormat(filepath, mode='r')

        with self.assertRaisesRegex(ValidationError, 'No records found'):
            format.validate()

    def test_alpha_diversity_format_validate_negative_too_few_cols(self):
        filepath = self.get_data_path('alpha-diversity-one-column.tsv')
        format = AlphaDiversityFormat(filepath, mode='r')

        with self.assertRaisesRegex(ValidationError, 'line 1.*2 columns'):
            format.validate()

    def test_alpha_diversity_format_validate_negative_jagged_rows(self):
        filepath = self.get_data_path('alpha-diversity-jagged-rows.tsv')

        format = AlphaDiversityFormat(filepath, mode='r')