From dcd566cae569fd6ce3d9e6cd30a4f833bc986999 Mon Sep 17 00:00:00 2001 From: Matt Stone Date: Tue, 17 Oct 2023 12:43:18 -0400 Subject: [PATCH] fix: report name of failing tag --- fgpyo/sam/__init__.py | 2 +- fgpyo/sam/tests/test_template_iterator.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fgpyo/sam/__init__.py b/fgpyo/sam/__init__.py index 1f8a1e64..81bf3172 100644 --- a/fgpyo/sam/__init__.py +++ b/fgpyo/sam/__init__.py @@ -857,7 +857,7 @@ def set_tag( value: The value of the tag. """ - assert len(tag) == 2, "Tags must be 2 characters." + assert len(tag) == 2, f"Tags must be 2 characters: {tag}." for rec in self.all_recs(): rec.set_tag(tag, value) diff --git a/fgpyo/sam/tests/test_template_iterator.py b/fgpyo/sam/tests/test_template_iterator.py index 5c060355..ac2e2ad7 100644 --- a/fgpyo/sam/tests/test_template_iterator.py +++ b/fgpyo/sam/tests/test_template_iterator.py @@ -92,5 +92,5 @@ def test_set_tag() -> None: # test tags that aren't two characters for bad_tag in ["", "A", "ABC", "ABCD"]: - with pytest.raises(AssertionError, match="Tags must be 2 characters."): + with pytest.raises(AssertionError, match="Tags must be 2 characters"): template.set_tag(bad_tag, VALUE)