-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtest_cli.py
More file actions
61 lines (47 loc) · 1.97 KB
/
Copy pathtest_cli.py
File metadata and controls
61 lines (47 loc) · 1.97 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""Unit tests for ccflow.ui.panel.cli module."""
from ccflow.ui.panel.cli import _get_ui_args_parser
class TestGetUIArgsParser:
"""Tests for _get_ui_args_parser function.
Note: Default values for hydra config args and panel server args are tested
in ccflow/tests/utils/test_hydra.py. These tests focus on viewer-specific
arguments and verifying the parser composition works correctly.
"""
def test_parser_composition(self):
"""Test parser includes args from both helper functions."""
parser = _get_ui_args_parser()
args = parser.parse_args([])
# From add_hydra_config_args
assert hasattr(args, "overrides")
assert hasattr(args, "config_path")
assert hasattr(args, "config_name")
# From add_panel_server_args
assert hasattr(args, "address")
assert hasattr(args, "port")
assert hasattr(args, "show")
# Viewer-specific
assert hasattr(args, "browser_width")
assert hasattr(args, "title")
def test_viewer_layout_defaults(self):
"""Test default values for viewer-specific arguments."""
parser = _get_ui_args_parser()
args = parser.parse_args([])
assert args.browser_width == 400
assert args.title == "ccflow Model Registry"
def test_viewer_layout_custom_values(self):
"""Test setting custom values for viewer layout arguments."""
parser = _get_ui_args_parser()
args = parser.parse_args(
[
"--browser-width",
"500",
"--title",
"My Registry",
]
)
assert args.browser_width == 500
assert args.title == "My Registry"
def test_overrides_positional(self):
"""Test overrides are captured as positional arguments."""
parser = _get_ui_args_parser()
args = parser.parse_args(["key1=value1", "key2=value2"])
assert args.overrides == ["key1=value1", "key2=value2"]