Skip to content

Commit

Permalink
missing uses (#969)
Browse files Browse the repository at this point in the history
* missing uses

* BUG: ignore_none was ignored, thanks @antgonza!
  • Loading branch information
wasade committed May 10, 2024
1 parent 9c22c9b commit cc30d6f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: Release

on: [push, pull_request]
on:
push:
tags:
- '*'

env:
earliest_python: "3.8"
latest_python: "3.12"
miniforge_version: "23.11.0-0"
miniforge_variant: "Mambaforge"

jobs:
build_sdist:
Expand Down Expand Up @@ -64,9 +73,11 @@ jobs:
- name: Build wheels (py ${{ matrix.pyver }}) Windows
if: matrix.os == 'windows-latest'
env:
CIBW_ARCHS_WINDOWS: "amd64 win32 arm64"
CIBW_ARCHS_WINDOWS: "amd64 win32"
CIBW_BUILD: "cp${{ matrix.pyver }}-*"

uses: pypa/[email protected]

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
Expand All @@ -90,7 +101,7 @@ jobs:
- name: Check artifacts
run: ls -lrt dist/

- name: Publish a Python distribution to PyPI
- name: Publish Distribution
uses: pypa/[email protected]
with:
user: __token__
Expand Down
2 changes: 1 addition & 1 deletion biom/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2488,7 +2488,7 @@ def part_f(i, m):
for vals, id_, md in self.iter(dense=False, axis=axis):
part = part_f(id_, md)

if part is None:
if ignore_none and part is None:
continue

# try to make it hashable...
Expand Down
16 changes: 15 additions & 1 deletion biom/tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -4309,7 +4309,7 @@ def test_partition_remove_empty(self):
False: Table(np.array([[1, 2]]), ['O1', ], ['S2', 'S3'])}
self.assertEqual(obs, exp)

def test_partition_ignore_none(self):
def test_partition_ignore_none_true(self):
t = Table(np.array([[0, 1, 2],
[3, 0, 0],
[4, 0, 0]]),
Expand All @@ -4321,6 +4321,20 @@ def test_partition_ignore_none(self):
['O1', 'O2', 'O3'], ['S1', ])}
self.assertEqual(obs, exp)

def test_partition_ignore_none_false(self):
t = Table(np.array([[0, 1, 2],
[3, 0, 0],
[4, 0, 0]]),
['O1', 'O2', 'O3'],
['S1', 'S2', 'S3'])
part_f = lambda i, m: True if i == 'S1' else None # noqa
obs = dict(t.partition(part_f, ignore_none=False))
exp = {True: Table(np.array([[0, ], [3, ], [4, ]]),
['O1', 'O2', 'O3'], ['S1', ]),
None: Table(np.array([[1, 2], [0, 0], [0, 0]]),
['O1', 'O2', 'O3'], ['S2', 'S3'])}
self.assertEqual(obs, exp)

def test_partition_dict_ids_to_groups(self):
t = Table(np.array([[0, 1, 2],
[3, 0, 0],
Expand Down

0 comments on commit cc30d6f

Please sign in to comment.