Skip to content

Commit

Permalink
Merge 25a5c59 into 506def6
Browse files Browse the repository at this point in the history
  • Loading branch information
yanksyoon authored Apr 8, 2024
2 parents 506def6 + 25a5c59 commit 10c4f5e
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 10c4f5e

Please sign in to comment.