diff --git a/test/unit/data/datatypes/test_sequence.py b/test/unit/data/datatypes/test_sequence.py index fefc6963121b..64982e89d637 100644 --- a/test/unit/data/datatypes/test_sequence.py +++ b/test/unit/data/datatypes/test_sequence.py @@ -1,12 +1,24 @@ +import pytest + from galaxy.datatypes.sequence import ( Fasta, FastqSanger, FastqSolexa, ) -from .util import get_dataset +from .util import ( + get_dataset, + MockDatasetDataset, +) -def test_fasta_set_meta(): +@pytest.mark.parametrize( + "input_file", + [ + "1.fasta", + "1.fasta.gz", + ], +) +def test_fasta_set_meta(input_file): b = Fasta() with get_dataset("1.fasta") as dataset: b.set_meta(dataset=dataset) @@ -14,41 +26,19 @@ def test_fasta_set_meta(): assert dataset.metadata.sequences == 1 -def test_fastagz_set_meta(): - b = Fasta() - with get_dataset("1.fasta.gz") as dataset: - b.set_meta(dataset=dataset) - assert dataset.metadata.data_lines == 2 - assert dataset.metadata.sequences == 1 - - -def test_fastqsanger_set_meta(): - b = FastqSanger() +@pytest.mark.parametrize( + "fastq_type,input_file", + [ + [FastqSanger, "1.fastqsanger"], + [FastqSanger, "1.fastqsanger.gz"], + [FastqSanger, "1.fastqsanger.bz2"], + [FastqSolexa, "1.fastqssolexa"], + ], +) +def test_fastqsanger_set_meta(fastq_type, input_file): + b = fastq_type() with get_dataset("1.fastqsanger") as dataset: - b.set_meta(dataset=dataset) - assert dataset.metadata.data_lines == 8 - assert dataset.metadata.sequences == 2 - - -def test_fastqsangergz_set_meta(): - b = FastqSanger() - with get_dataset("1.fastqsanger.gz") as dataset: - b.set_meta(dataset=dataset) - assert dataset.metadata.data_lines == 8 - assert dataset.metadata.sequences == 2 - - -def test_fastqsangerbz2_set_meta(): - b = FastqSanger() - with get_dataset("1.fastqsanger.bz2") as dataset: - b.set_meta(dataset=dataset) - assert dataset.metadata.data_lines == 8 - assert dataset.metadata.sequences == 2 - - -def test_fastqsolexa_set_meta(): - b = FastqSolexa() - with get_dataset("1.fastqsolexa") as dataset: + dataset.dataset = MockDatasetDataset(dataset.get_file_name()) b.set_meta(dataset=dataset) assert dataset.metadata.data_lines == 8 assert dataset.metadata.sequences == 2