Skip to content

Commit c696fb8

Browse files
committed
Skip NaiveBayes test if numpy.float64 is unhashable.
This closes GitHub issue #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 56f1ba3 commit c696fb8

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎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
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)