Skip to content

Commit 6c9f778

Browse files
author
Théophile Baranger
committed
remove in-function parameter validation for datasets.make_moons
1 parent 5143a01 commit 6c9f778

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

sklearn/datasets/_samples_generator.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -819,12 +819,7 @@ def make_moons(n_samples=100, *, shuffle=True, noise=None, random_state=None):
819819
n_samples_out = n_samples // 2
820820
n_samples_in = n_samples - n_samples_out
821821
else:
822-
try:
823-
n_samples_out, n_samples_in = n_samples
824-
except ValueError as e:
825-
raise ValueError(
826-
"`n_samples` can be either an int or a two-element tuple."
827-
) from e
822+
n_samples_out, n_samples_in = n_samples
828823

829824
generator = check_random_state(random_state)
830825

sklearn/datasets/tests/test_samples_generator.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -636,18 +636,6 @@ def test_make_moons_unbalanced():
636636
assert X.shape == (12, 2), "X shape mismatch"
637637
assert y.shape == (12,), "y shape mismatch"
638638

639-
with pytest.raises(
640-
ValueError,
641-
match=r"`n_samples` can be either an int " r"or a two-element tuple.",
642-
):
643-
make_moons(n_samples=[1, 2, 3])
644-
645-
with pytest.raises(
646-
ValueError,
647-
match=r"`n_samples` can be either an int " r"or a two-element tuple.",
648-
):
649-
make_moons(n_samples=(10,))
650-
651639

652640
def test_make_circles():
653641
factor = 0.3

0 commit comments

Comments
 (0)