Skip to content

Commit

Permalink
fix tests for primer formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
BjornFJohansson committed Dec 7, 2023
1 parent e8eddfa commit e9dd7a6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/pydna/myprimers.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def pydna_code_from_list(self, lst: list):
try:
prstrs.index(str(p.seq).upper())
except ValueError as e:
print(f"{p.format('fasta-2line')}")
print(f"{p.format('primer')}")
err = e
else:
indices.append(self.data.index(p))
Expand All @@ -168,7 +168,7 @@ def pydna_code_from_list(self, lst: list):
msg += f"{self.identifier} = {curly}\n\n"
msg += ", ".join(f"{self.identifier}[{i}]" for i in indices)
msg += " = parse_primers('''\n\n"
msg += "\n".join(self[i].format("fasta-2line") for i in indices)
msg += "\n".join(self[i].format("primer") for i in indices)
msg += "\n''')"
return _pretty_str(msg)

Expand Down
2 changes: 1 addition & 1 deletion src/pydna/seqrecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ def removeprefix(text, prefix):
)
if format == "primer":
return _pretty_str(
f">{self.id} {len(self)}-mer {removeprefix(self.description, self.name).strip()}\n{str(self.seq)}\n"
f">{self.id} {len(self)}-mer{removeprefix(self.description, self.name).strip()}\n{str(self.seq)}\n"
)
return _pretty_str(super().__format__(format))

Expand Down
10 changes: 5 additions & 5 deletions tests/test_module_myprimers.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ def test_PrimerList_init(monkeypatch):
p[0], p[1], p[2], p[3] = parse_primers('''
>0_primer
>0_primer 8-mer
tttttttt
>1_primer
>1_primer 8-mer
gggggggg
>2_primer
>2_primer 8-mer
cccccccc
>3_primer
>3_primer 8-mer
aaaaaaaa
''')"""
Expand Down Expand Up @@ -145,4 +145,4 @@ def test_find_duplicate_primers(monkeypatch):


if __name__ == "__main__":
pytest.main([__file__, "-v", "-s"])
pytest.main([__file__, "-vvv", "-s"])

0 comments on commit e9dd7a6

Please sign in to comment.