8000 Skip NaiveBayes test if numpy.float64 is unhashable. · MarkusPiotrowski/biopython@e719856 · GitHub
[go: up one dir, main page]

Skip to content

Commit e719856

Browse files
peterjcMarkusPiotrowski
authored andcommitted
Skip NaiveBayes test if numpy.float64 is unhashable.
This closes GitHub issue biopython#1112 where under PyPy3.5 v5.7 beta a bug in NumPy 1.12.1 makes numpy.float64 unhashable. See numpy/numpy#8887
1 parent bbebd46 commit e719856

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Tests/test_NaiveBayes.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@
44

55
try:
66
import numpy
9876 7-
del numpy
87
except ImportError:
98
from Bio import MissingPythonDependencyError
109
raise MissingPythonDependencyError(
1110
"Install NumPy if you want to use Bio.NaiveBayes.")
11+
try:
12+
hash(numpy.float64(123.456))
13+
except TypeError:
14+
# Due to a bug in NumPy 1.12.1, this is unhashable under
15+
# PyPy3.5 v5.7 beta - it has been fixed in NumPy
16+
from Bio import MissingPythonDependencyError
17+
raise MissingPythonDependencyError(
18+
"Please update NumPy if you want to use Bio.NaiveBayes "
19+
"(under this version numpy.float64 is unhashable).")
20+
del numpy
1221

1322
from Bio import NaiveBayes
1423

0 commit comments

Comments
 (0)
0