aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lesana/collection.py4
-rw-r--r--tests/test_collection.py7
2 files changed, 6 insertions, 5 deletions
diff --git a/lesana/collection.py b/lesana/collection.py
index f877d31..d49512a 100644
--- a/lesana/collection.py
+++ b/lesana/collection.py
@@ -59,7 +59,7 @@ class Entry(object):
else:
data[name] = field.empty()
if field.field.get('help', None) is not None:
- comment = "# {name} ({type}): {help}\n".format(**field.field)
+ comment = "{name} ({type}): {help}\n".format(**field.field)
try:
data.yaml_set_comment_before_after_key(
key=name,
@@ -73,7 +73,7 @@ class Entry(object):
)
valid_values = field.field.get('values', [])
if valid_values:
- comment = "# {name} ({type}): {valid_values}".format(
+ comment = "{name} ({type}): {valid_values}".format(
valid_values="|".join(valid_values),
**field.field
)
diff --git a/tests/test_collection.py b/tests/test_collection.py
index 1400f57..99a5517 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -48,9 +48,10 @@ class testEntries(unittest.TestCase):
entry_fname = os.path.join(self.basepath, new_entry.fname)
with open(entry_fname) as fp:
text = fp.read()
- self.assertIn('quantity (integer): how many items are there', text)
- self.assertIn('other (yaml):', text)
- self.assertNotIn('position (string)', text)
+ self.assertIn('# quantity (integer): how many items are there', text)
+ self.assertIn('# other (yaml):', text)
+ self.assertNotIn('# position (string)', text)
+ self.assertNotIn('# # other (yaml)', text)
written = ruamel.yaml.safe_load(text)
self.assertIsInstance(written['quantity'], int)
self.assertIsInstance(written['name'], str)