def test_allow_lowercase_2_mer(): seq = minimal( dna(min_size=2, uppercase_only=False, allow_gaps=False, allow_ambiguous=False), lambda x: all(c not in ["A", "T", "C", "G"] for c in x), ) assert seq == "aa"
def test_allow_ambiguous_smallest_example(): seq = minimal( dna(min_size=1, allow_ambiguous=True, allow_gaps=False, uppercase_only=True), lambda x: all(c not in ["A", "T", "C", "G"] for c in x), ) assert seq == "B"
@given(fasta()) def test_return_type(seq): assert type(seq) == str @given(fasta(wrap_length=5)) def test_wrap_length(seq): assert all([ len(x.rstrip()) == 5 for x in seq.split("\n")[:-1] if not x.startswith(">") ]) @given(fasta(allow_windows_line_endings=False)) def test_no_windows_line_endings(seq): assert "\r" not in seq @given( fasta( comment_source=dna(uppercase_only=True, allow_ambiguous=False, allow_gaps=False), sequence_source=dna(uppercase_only=True, allow_ambiguous=False, allow_gaps=False), )) def test_sources(seq): assert set(seq).issubset({"\r", "\n", "A", "T", "G", "C", ">"})
def test_2_mer(): assert minimal(dna(min_size=2)) == "AA"
def test_smallest_non_empty_example(): assert minimal(dna(min_size=1)) == "A"
def test_smallest_example(): assert minimal(dna()) == ""
from hypothesis import given from .minimal import minimal from hypothesis_bio import dna @given(dna()) def test_dna_type(seq): assert type(seq) == str def test_smallest_example(): assert minimal(dna()) == "" def test_smallest_non_empty_example(): assert minimal(dna(min_size=1)) == "A" def test_2_mer(): assert minimal(dna(min_size=2)) == "AA" @given(dna(max_size=10)) def test_max_size(seq): assert len(seq) <= 10
def test_allow_gaps_2_mer(): seq = minimal( dna(min_size=2, allow_gaps=True, allow_ambiguous=False), lambda x: all(c not in ["A", "U", "C", "G"] for c in x), ) assert seq == "--"