Skip to content

Commit 58ddbb0

Browse files
committed
fix test failures: formatting, use of deprecated qname instead of rec.query_name
1 parent fef0a28 commit 58ddbb0

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

fgpyo/sam/tests/test_umi_methods.py

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import pytest
2-
from fgpyo.sam import extract_umis_from_read_name, _is_valid_umi, copy_umi_from_read_name, AlignedSegment
2+
3+
from fgpyo.sam import _is_valid_umi
4+
from fgpyo.sam import copy_umi_from_read_name
5+
from fgpyo.sam import extract_umis_from_read_name
36
from fgpyo.sam.builder import SamBuilder
47

58

@@ -51,39 +54,44 @@ def test_extract_umi_from_read_name_raises(read_name: str) -> None:
5154
with pytest.raises(ValueError):
5255
extract_umis_from_read_name(read_name)
5356

57+
5458
@pytest.mark.parametrize(
5559
"read_name, extraction",
5660
[
57-
("abc:def:ghi:jfk:lmn:opq:ACGT",None), #colons == 6
58-
("abc:def:ghi:jfk:lmn:opq:rst:ACGT","ACGT"), #colons == 7
61+
("abc:def:ghi:jfk:lmn:opq:ACGT", None), # colons == 6
62+
("abc:def:ghi:jfk:lmn:opq:rst:ACGT", "ACGT"), # colons == 7
5963
],
6064
)
6165
def test_strict_extract_umi_from_read_name(read_name: str, extraction: str) -> None:
6266
"""Test that we raise an error when strict=True and number of colons is not 7 or 8."""
6367
assert extract_umis_from_read_name(read_name, strict=True) == extraction
6468

69+
6570
@pytest.mark.parametrize(
6671
"read_name",
6772
[
6873
("abc:def:ghi:jfk"),
6974
("abc:def:ghi:jfk:lmn:opq:rst:uvw:xyz"),
70-
("abc:def:ghi:jfk:lmn:opq:rst:") #Invalid UMI
75+
("abc:def:ghi:jfk:lmn:opq:rst:"), # Invalid UMI
7176
],
7277
)
7378
def test_strict_extract_umi_from_read_name_raises(read_name: str) -> None:
7479
"""Test that we raise an error when strict=True and number of colons is not 7 or 8."""
7580
with pytest.raises(ValueError):
76-
extract_umis_from_read_name(read_name,strict=True)
81+
extract_umis_from_read_name(read_name, strict=True)
82+
83+
7784
def test_copy_umi_from_read_name() -> None:
7885
builder = SamBuilder()
7986
read = builder.add_single(name="read_name:GATTACA")
8087
copy_umi_from_read_name(read, remove_umi=False)
81-
assert read.qname == "read_name:GATTACA"
88+
assert read.query_name == "read_name:GATTACA"
8289
assert read.get_tag("RX") == "GATTACA"
8390

91+
8492
def test_copy_remove_umi_from_read_name() -> None:
8593
builder = SamBuilder()
8694
read = builder.add_single(name="read_name:GATTACA")
8795
copy_umi_from_read_name(read, remove_umi=True)
88-
assert read.qname == "read_name"
89-
assert read.get_tag("RX") == "GATTACA"
96+
assert read.query_name == "read_name"
97+
assert read.get_tag("RX") == "GATTACA"

0 commit comments

Comments
 (0)