Skip to content

Commit

Permalink
Merge branch 'main' into issue-224
Browse files Browse the repository at this point in the history
  • Loading branch information
jarbesfeld committed Jan 16, 2025
2 parents 23a1644 + a64df63 commit ac5a770
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/fusor/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ class ContigSequence(BaseStructuralElement):
contig: Annotated[
str,
StringConstraints(
strip_whitespace=True, to_upper=True, pattern=r"^(?:[^A-Za-z]|[ACTGactg])*$"
strip_whitespace=True,
to_upper=True,
pattern=r"^(?:[^A-Za-z0-9]|[ACTGactg])*$",
),
]

Expand Down
9 changes: 9 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,12 +641,21 @@ def test_contig():
test_contig = ContigSequence(contig="GTATACTATGATCAGT")
assert test_contig.contig == "GTATACTATGATCAGT"

test_contig = ContigSequence(contig="GTATACTATGATCAGT|ATGATCATGAT")
assert test_contig.contig == "GTATACTATGATCAGT|ATGATCATGAT"

# test enum validation
with pytest.raises(ValidationError) as exc_info:
assert ContigSequence(type="contig")
msg = "Input should be <FUSORTypes.CONTIG_SEQUENCE: 'ContigSequence'>"
check_validation_error(exc_info, msg)

# test invalid input
with pytest.raises(ValidationError) as exc_info:
ContigSequence(contig="1212341|ATGATCATGAT")
msg = "String should match pattern '^(?:[^A-Za-z0-9]|[ACTGactg])*$'"
check_validation_error(exc_info, msg)


def test_anchored_reads():
"""Test that AnchoredReads class initializes correctly"""
Expand Down

0 comments on commit ac5a770

Please sign in to comment.