diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0bd76e8..ebfea68 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -85,8 +85,16 @@ jobs: test -f .coverage || uvx hatch run ${{ matrix.env.name }}:cov-combine uvx hatch run ${{ matrix.env.name }}:cov-report # report visibly uvx hatch run ${{ matrix.env.name }}:coverage xml # create report for upload + # Quick sanity check + grep -m1 'filename=' -n coverage.xml || { echo "coverage.xml missing filenames"; exit 1; } - name: Upload coverage + env: + CODECOV_TOKEN: ${{ secrets.CODECOV }} uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV }} + files: ./coverage.xml + verbose: true # Check that all tests defined above pass. This makes it easy to set a single "required" test in branch # protection instead of having to update it frequently. See https://github.com/re-actors/alls-green#why. diff --git a/README.md b/README.md index 3ab68d6..82e2a70 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ [![Tests][badge-tests]][link-tests] [![Documentation][badge-docs]][link-docs] [![PyPI](https://img.shields.io/pypi/v/treedata.svg)](https://pypi.org/project/treedata) +[![codecov](https://codecov.io/github/YosefLab/treedata/branch/main/graph/badge.svg?token=YPhuxlw4my)](https://codecov.io/github/YosefLab/treedata) [badge-tests]: https://img.shields.io/github/actions/workflow/status/YosefLab/treedata/test.yaml?branch=main [link-tests]: https://github.com/YosefLab/treedata/actions/workflows/test.yaml diff --git a/src/treedata/_core/treedata.py b/src/treedata/_core/treedata.py index 4109ae7..b772894 100755 --- a/src/treedata/_core/treedata.py +++ b/src/treedata/_core/treedata.py @@ -301,6 +301,12 @@ def vart(self, value): self._vart = vart self._update_has_overlap() + @label.setter + def label(self, value): + if value is not None and not isinstance(value, str): + raise ValueError("label has to be a string or None") + self._tree_label = value + @allow_overlap.setter def allow_overlap(self, value): if not isinstance(value, bool): diff --git a/tests/test_merge.py b/tests/test_merge.py index a84f638..746aa0e 100755 --- a/tests/test_merge.py +++ b/tests/test_merge.py @@ -144,6 +144,18 @@ def test_subset_alignment(nodes_tdata): assert list(tdata.vart.keys()) == ["tree"] +def test_merge_multiple_values(tdata_list): + # Test merging with mumtiple tree values + tdata_list[0].label = "other" + with pytest.warns(UserWarning): + tdata = td.concat(tdata_list, axis=0, join="outer", merge="first") + assert tdata.label == "tree" + tdata_list[1].alignment = "subset" + with pytest.warns(UserWarning): + tdata = td.concat(tdata_list, axis=0, join="outer", merge="first") + assert tdata.alignment == "subset" + + def test_concat_bad_index(tdata_list): tdata_list[0].obs.index = tdata_list[1].obs.index with pytest.raises(ValueError):