Skip to content

Commit

Permalink
Merge 39a9c4c into 459f63c
Browse files Browse the repository at this point in the history
  • Loading branch information
yanksyoon committed Apr 8, 2024
2 parents 459f63c + 39a9c4c commit 9d026d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/charm_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _valid_storage_size_str(size: str) -> bool:
return size[-3:] in valid_suffixes and size[:-3].isdigit()


WORD_ONLY_REGEX = re.compile("^\\w+$")
WORD_ONLY_REGEX = re.compile("^[\\w\\-]+$")


def _parse_labels(labels: str) -> tuple[str, ...]:
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/test_charm_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,14 @@ def test__parse_labels_invalid_labels(label_str: str, falsy_labels: tuple[str]):
pytest.param(" a, b, c", ("a", "b", "c"), id="comma separated labels with space"),
pytest.param("1234", ("1234",), id="numeric label"),
pytest.param("_", ("_",), id="underscore"),
pytest.param("-", ("-",), id="dash only"),
pytest.param("_test_", ("_test_",), id="alphabetical with underscore"),
pytest.param("_test1234_", ("_test1234_",), id="alphanumeric with underscore"),
pytest.param("x-large", ("x-large",), id="dash word"),
pytest.param("x-large, two-xlarge", ("x-large", "two-xlarge"), id="dash words"),
pytest.param(
"x-large_1, two-xlarge", ("x-large_1", "two-xlarge"), id="dash underscore words"
),
],
)
def test__parse_labels(label_str: str, expected_labels: tuple[str]):
Expand Down

0 comments on commit 9d026d9

Please sign in to comment.