forked from facebook/Ax
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_should_generate_candidates.py
More file actions
34 lines (28 loc) · 1.22 KB
/
test_should_generate_candidates.py
File metadata and controls
34 lines (28 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from random import randint
from ax.analysis.healthcheck.healthcheck_analysis import HealthcheckStatus
from ax.analysis.healthcheck.should_generate_candidates import ShouldGenerateCandidates
from ax.utils.common.testutils import TestCase
class TestShouldGenerateCandidates(TestCase):
def test_should(self) -> None:
trial_index = randint(0, 10)
card = ShouldGenerateCandidates(
should_generate=True,
reason="Something reassuring",
trial_index=trial_index,
).compute()
self.assertEqual(card.get_status(), HealthcheckStatus.PASS)
self.assertEqual(card.subtitle, "Something reassuring")
def test_should_not(self) -> None:
trial_index = randint(0, 10)
card = ShouldGenerateCandidates(
should_generate=False,
reason="Something concerning",
trial_index=trial_index,
).compute()
self.assertEqual(card.get_status(), HealthcheckStatus.INFO)
self.assertEqual(card.subtitle, "Something concerning")