Skip to content

Commit 634cb1e

Browse files
committed
Don't format comments in clean_comment
As noted in dask/helm-chart#92 (comment), in some comments capitalization is important so frigate shouldn't change it.
1 parent 874493d commit 634cb1e

2 files changed

Lines changed: 15 additions & 12 deletions

File tree

frigate/gen.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,13 @@ def get_comment(tree, key):
166166
def clean_comment(comment):
167167
"""Remove comment formatting.
168168
169-
Strip a comment down and turn it into a standalone human readable sentence.
169+
Strip a comment.
170170
171171
Examples:
172172
Strip down a comment
173173
174174
>>> clean_comment("# hello world")
175-
"Hello world"
175+
"hello world"
176176
177177
Args:
178178
comment (str): Comment to clean
@@ -181,7 +181,7 @@ def clean_comment(comment):
181181
str: Cleaned sentence
182182
183183
"""
184-
return comment.strip("# ").capitalize()
184+
return comment.strip("# ")
185185

186186

187187
def traverse(tree, root=None):

frigate/tests/test_frigate.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def test_get_comment(yaml):
6262
from frigate.gen import get_comment
6363

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

6767
tree = yaml.load(
6868
"""
@@ -71,7 +71,7 @@ def test_get_comment(yaml):
7171
# this is also not the comment
7272
"""
7373
)
74-
assert get_comment(tree, "hello") == "This is the comment"
74+
assert get_comment(tree, "hello") == "this is the comment"
7575

7676
tree = yaml.load(
7777
"""
@@ -82,7 +82,7 @@ def test_get_comment(yaml):
8282
# this is also not the comment
8383
"""
8484
)
85-
assert get_comment(tree, "hello") == "This is the comment"
85+
assert get_comment(tree, "hello") == "this is the comment"
8686

8787
tree = yaml.load(
8888
"""
@@ -94,7 +94,7 @@ def test_get_comment(yaml):
9494
# this is also not the comment
9595
"""
9696
)
97-
assert get_comment(tree, "hello") == "This is the comment"
97+
assert get_comment(tree, "hello") == "this is the comment"
9898

9999
tree = yaml.load(
100100
"""
@@ -107,14 +107,17 @@ def test_get_comment(yaml):
107107
)
108108
assert get_comment(tree, "hello") == ""
109109

110+
tree = yaml.load("hello: world # Use a `LoadBalancer`.")
111+
assert get_comment(tree, "hello") == "Use a `LoadBalancer`."
112+
110113

111114
def test_clean_comment():
112115
from frigate.gen import clean_comment
113116

114-
assert clean_comment("# hello world") == "Hello world"
115-
assert clean_comment("hello world") == "Hello world"
116-
assert clean_comment("## # ## ## hello world") == "Hello world"
117-
assert clean_comment(" # hello world ") == "Hello world"
117+
assert clean_comment("# hello world") == "hello world"
118+
assert clean_comment("hello world") == "hello world"
119+
assert clean_comment("## # ## ## hello world") == "hello world"
120+
assert clean_comment(" # hello world ") == "hello world"
118121

119122

120123
def test_traversal(simple_chart, rich_chart):
@@ -129,7 +132,7 @@ def test_traversal(simple_chart, rich_chart):
129132

130133
assert [
131134
"replicaCount",
132-
"Number of nginx pod replicas to create",
135+
"number of nginx pod replicas to create",
133136
"1",
134137
] in rich_output
135138

0 commit comments

Comments
 (0)