Skip to content
This repository has been archived by the owner on Feb 26, 2025. It is now read-only.

Commit

Permalink
🐛 Make the CI actually run tox (#863)
Browse files Browse the repository at this point in the history
And add a test file required by the previous commit.
  • Loading branch information
Benoit Coste authored Jan 11, 2021
1 parent eacb2d3 commit 192a27f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion neurom/apps/morph_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _fill_stats_dict(data, stat_name, stat, shape):
for i in range(shape[1]):
data[f'{stat_name}_{i}'] = stat[i] if stat is not None else None
elif len(shape) > 2:
raise ValueError(f'Feature with wrong shape: {shape}')
raise ValueError(f'Feature with wrong shape: {shape}') # pragma: no cover
else:
data[stat_name] = stat

Expand Down
9 changes: 3 additions & 6 deletions neurom/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ def register_neurite_feature(name, func):
func: single parameter function of a neurite.
"""
if name in NEURITEFEATURES:
raise NeuroMError('Attempt to hide registered feature %s' % name)

def _fun(neurites, neurite_type=_ntype.all):
"""Wrap neurite function from outer scope and map into list."""
return list(func(n) for n in _ineurites(neurites, filt=_is_type(neurite_type)))
Expand Down Expand Up @@ -138,9 +135,6 @@ def get_docstring(func):
return '\n'.join(ret)


get.__doc__ += _indent('\nFeatures:\n', 1) + _indent(_get_doc(), 2) # pylint: disable=no-member


def _register_feature(namespace, name, func, shape):
"""Register a feature to be applied.
Expand Down Expand Up @@ -182,3 +176,6 @@ def inner(func):

# These imports are necessary in order to register the features
from neurom.features import neuritefunc, neuronfunc # noqa, pylint: disable=wrong-import-position

# This must be done after all features have been registered
get.__doc__ += _indent('\nFeatures:\n', 1) + _indent(_get_doc(), 2) # pylint: disable=no-member
4 changes: 4 additions & 0 deletions neurom/features/tests/test_get_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,10 @@ def vol(neurite):
n_volume = get_feature('bar', POP, neurite_type=NeuriteType.basal_dendrite)
assert_items_equal(n_volume, n_volume_ref)

@nt.raises(NeuroMError)
def test_get_raises():
get_feature('ahah-I-do-not-exist!', lambda n: None)


@nt.raises(NeuroMError)
def test_register_existing_feature_raises():
Expand Down
11 changes: 11 additions & 0 deletions test_data/swc/no-axon.swc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This neuron has no axon

1 1 0 0 0 1. -1
2 3 0 0 0 1. 1
3 3 0 5 0 1. 2
4 3 -5 5 0 0. 3
5 3 6 5 0 0. 3
6 4 0 0 0 1. 1
7 4 0 -4 0 1. 6
8 4 6 -4 0 0. 7
9 4 -5 -4 0 0. 7
6 changes: 6 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,9 @@ max-line-length=100

[pydocstyle]
convention = google

[gh-actions]
python =
3.6: py36, py36-plotly, py36-lint, py36-docs, py36-coverage
3.7: py37
3.8: py38

0 comments on commit 192a27f

Please sign in to comment.