8000 Fix test_tree for x64 builds and flake · scikit-learn/scikit-learn@cdb6133 · GitHub
[go: up one dir, main page]

Skip to content

Commit cdb6133

Browse files
committed
Fix test_tree for x64 builds and flake
1 parent c9435c9 commit cdb6133

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

sklearn/tree/_tree.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ cdef class Tree:
542542
reaching node i.
543543
"""
544544
# Wrap for outside world.
545-
# WARNING: these copy the current `nodes` and `value` buffers, which
545+
# WARNING: these reference the current `nodes` and `value` buffers, which
546546
# must not be freed by a subsequent memory allocation.
547547
# (i.e. through `_resize` or `__setstate__`)
548548
property n_classes:

sklearn/tree/tests/test_tree.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,10 +1619,12 @@ def test_criterion_copy():
16191619
# Let's check whether copy of our criterion has the same type
16201620
# and properties as original
16211621
n_outputs = 3
1622-
n_classes = np.arange(3)
1622+
n_classes = np.arange(3, dtype=np.intp)
16231623
n_samples = 100
1624-
pickle_copy = lambda obj: pickle.loads(pickle.dumps(obj))
1625-
for copy_func in [copy.copy, copy.deepcopy, pickle_copy]:
1624+
1625+
def _pickle_copy(obj):
1626+
return pickle.loads(pickle.dumps(obj))
1627+
for copy_func in [copy.copy, copy.deepcopy, _pickle_copy]:
16261628
for _, typename in CRITERIA_CLF.items():
16271629
criteria = typename(n_outputs, n_classes)
16281630
result = copy_func(criteria).__reduce__()

0 commit comments

Comments
 (0)
0