Skip to content

Commit

Permalink
Fix future warning for neighbors in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ivirshup committed May 14, 2020
1 parent 058de9b commit 8e999a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scanpy/tests/test_neighbors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

import numpy as np
import pytest
from anndata import AnnData
Expand Down Expand Up @@ -159,6 +161,9 @@ def test_restore_n_neighbors(neigh, conv):
neigh.compute_neighbors(method='gauss', n_neighbors=n_neighbors)

ad = AnnData(np.array(X))
ad.uns['neighbors'] = dict(connectivities=conv(neigh.connectivities))
# Allow deprecated usage for now
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=FutureWarning, module="anndata")
ad.uns['neighbors'] = dict(connectivities=conv(neigh.connectivities))
neigh_restored = Neighbors(ad)
assert neigh_restored.n_neighbors == 1

0 comments on commit 8e999a9

Please sign in to comment.