Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions frigate/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ def get_comment(tree, key):
def clean_comment(comment):
"""Remove comment formatting.

Strip a comment down and turn it into a standalone human readable sentence.
Strip a comment.

Examples:
Strip down a comment

>>> clean_comment("# hello world")
"Hello world"
"hello world"

Args:
comment (str): Comment to clean
Expand All @@ -181,7 +181,7 @@ def clean_comment(comment):
str: Cleaned sentence

"""
return comment.strip("# ").capitalize()
return comment.strip("# ")


def traverse(tree, root=None):
Expand Down
21 changes: 12 additions & 9 deletions frigate/tests/test_frigate.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_get_comment(yaml):
from frigate.gen import get_comment

tree = yaml.load("hello: world # this is the comment")
assert get_comment(tree, "hello") == "This is the comment"
assert get_comment(tree, "hello") == "this is the comment"

tree = yaml.load(
"""
Expand All @@ -71,7 +71,7 @@ def test_get_comment(yaml):
# this is also not the comment
"""
)
assert get_comment(tree, "hello") == "This is the comment"
assert get_comment(tree, "hello") == "this is the comment"

tree = yaml.load(
"""
Expand All @@ -82,7 +82,7 @@ def test_get_comment(yaml):
# this is also not the comment
"""
)
assert get_comment(tree, "hello") == "This is the comment"
assert get_comment(tree, "hello") == "this is the comment"

tree = yaml.load(
"""
Expand All @@ -94,7 +94,7 @@ def test_get_comment(yaml):
# this is also not the comment
"""
)
assert get_comment(tree, "hello") == "This is the comment"
assert get_comment(tree, "hello") == "this is the comment"

tree = yaml.load(
"""
Expand All @@ -107,14 +107,17 @@ def test_get_comment(yaml):
)
assert get_comment(tree, "hello") == ""

tree = yaml.load("hello: world # Use a `LoadBalancer`.")
assert get_comment(tree, "hello") == "Use a `LoadBalancer`."


def test_clean_comment():
from frigate.gen import clean_comment

assert clean_comment("# hello world") == "Hello world"
assert clean_comment("hello world") == "Hello world"
assert clean_comment("## # ## ## hello world") == "Hello world"
assert clean_comment(" # hello world ") == "Hello world"
assert clean_comment("# hello world") == "hello world"
assert clean_comment("hello world") == "hello world"
assert clean_comment("## # ## ## hello world") == "hello world"
assert clean_comment(" # hello world ") == "hello world"


def test_traversal(simple_chart, rich_chart):
Expand All @@ -129,7 +132,7 @@ def test_traversal(simple_chart, rich_chart):

assert [
"replicaCount",
"Number of nginx pod replicas to create",
"number of nginx pod replicas to create",
"1",
] in rich_output

Expand Down