Skip to content

Commit

Permalink
Have ContigBuilder.add() default to adding 1x the bases provided (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
clintval authored Nov 23, 2023
1 parent b8ac915 commit 66b2200
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fgpyo/fasta/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(
self.species = species
self.bases = ""

def add(self, bases: str, times: int) -> "ContigBuilder":
def add(self, bases: str, times: int = 1) -> "ContigBuilder":
"""
Method for adding bases to a new or existing instance of ContigBuilder.
Expand Down
7 changes: 7 additions & 0 deletions fgpyo/fasta/tests/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ def test_overrides_FastaBuilder() -> None:
assert builder.line_length == 90


def test_bases_length_from_ContigBuilder_add_default() -> None:
"""Checks that the default addition of bases is a single addition."""
builder = FastaBuilder()
builder.add("chr10").add("AAAA")
assert len(builder.__getitem__("chr10").bases) == 4


@pytest.mark.parametrize(
"name, bases, times, length_bases",
[
Expand Down

0 comments on commit 66b2200

Please sign in to comment.