Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/treedata/_core/treedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
12 changes: 12 additions & 0 deletions tests/test_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading