Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bernt-matthias committed Feb 13, 2024
1 parent e5ff242 commit 6b52d6d
Showing 1 changed file with 26 additions and 36 deletions.
62 changes: 26 additions & 36 deletions test/unit/data/datatypes/test_sequence.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,44 @@
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)
assert dataset.metadata.data_lines == 2
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

0 comments on commit 6b52d6d

Please sign in to comment.