Skip to content

Commit

Permalink
TST: add tests for case of empty data
Browse files Browse the repository at this point in the history
  • Loading branch information
rmcar17 committed May 2, 2024
1 parent db4cb41 commit fc0c729
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions tests/test_core/test_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3746,10 +3746,6 @@ def test_sequence_collection_repr():
seqs = SequenceCollection(data=data, moltype=ASCII)
assert repr(seqs) == "5x (b[BBB], ..., d[DDDDDDDDDD...]) text seqcollection"

data = {}
seqs = SequenceCollection(data=data, moltype=BYTES)
assert repr(seqs) == "0x () bytes seqcollection"


@pytest.mark.parametrize("cls", (ArrayAlignment, Alignment))
def test_alignment_repr(cls):
Expand Down Expand Up @@ -3798,9 +3794,9 @@ def test_alignment_repr(cls):
== "5 x 11 text alignment: a[AAAAAAAAAA...], b[BBBBBBBBBB...], c[CCCCCCCCCC...], ..."
)

if (
cls == ArrayAlignment
): # Can't construct an empty alignment with the Alignment class.
data = {}
seqs = cls(data=data, moltype=BYTES)
assert repr(seqs) == "0 x 0 bytes alignment: "

@pytest.mark.parametrize("cls", (ArrayAlignment, Alignment, SequenceCollection))
def test_empty_data(cls):
with pytest.raises(ValueError) as e:
_ = cls(())
assert str(e.value) == f"{cls.__name__} must take at least one sequence."

0 comments on commit fc0c729

Please sign in to comment.