From b828d9f65675a98f077761bdd1451fa4866c3dd2 Mon Sep 17 00:00:00 2001 From: Donald Campbell <125581724+donaldcampbelljr@users.noreply.github.com> Date: Mon, 15 Jul 2024 11:06:58 -0400 Subject: [PATCH] add pytest coverage #369 --- tests/smoketests/test_Sample.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/smoketests/test_Sample.py b/tests/smoketests/test_Sample.py index a9a933bd..77e42fbf 100644 --- a/tests/smoketests/test_Sample.py +++ b/tests/smoketests/test_Sample.py @@ -58,6 +58,16 @@ def test_str_repr_correctness(self, example_pep_cfg_path): assert example_pep_cfg_path in str_repr assert "Sample '{}'".format(sample["sample_name"]) in str_repr + @pytest.mark.parametrize("example_pep_cfg_path", EXAMPLE_TYPES, indirect=True) + def test_sample_to_yaml_no_path(self, example_pep_cfg_path): + """ + Verify that to_yaml returns representation without requiring a path. + """ + p = Project(cfg=example_pep_cfg_path) + for sample in p.samples: + yaml_repr = sample.to_yaml() + assert "sample_name" in yaml_repr + @pytest.mark.parametrize("example_pep_cfg_path", ["basic"], indirect=True) def test_sheet_dict_excludes_private_attrs(self, example_pep_cfg_path): """