-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
title_format overrides default top line #276
Conversation
Codecov Report
@@ Coverage Diff @@
## master #276 +/- ##
==========================================
+ Coverage 95.57% 95.86% +0.29%
==========================================
Files 20 20
Lines 1085 1089 +4
Branches 105 104 -1
==========================================
+ Hits 1037 1044 +7
+ Misses 27 25 -2
+ Partials 21 20 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good. Thanks. Only minor comments.
src/towncrier/test/test_format.py
Outdated
|
||
definitions = OrderedDict() | ||
|
||
expected_output = u"""A custom top line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to make the code a bit easier to read I would prefer to have the expect_outpupt" define just before the call to
self.assertEqual(output, expected_output)`
src/towncrier/test/test_format.py
Outdated
output = render_fragments( | ||
template, | ||
None, | ||
"A custom top line", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also. to make all these render_fragments easier to read, it woud be nice to call them with named arguments for all argumetns and not only
output = render_fragments( | |
template, | |
None, | |
"A custom top line", | |
output = render_fragments( | |
template=template, | |
issue_format=None, | |
top_line="A custom top line", |
src/towncrier/test/test_format.py
Outdated
|
||
expected_output = u"""A custom top line | ||
================= | ||
""" # NOQA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comment. Why do we need no qa here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing it was the indentation? Switched to dedent()
.
src/towncrier/test/test_format.py
Outdated
self.maxDiff = None | ||
|
||
fragments = {} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that maxDiff ended up after a debugging session :)
self.maxDiff = None | |
fragments = {} |
src/towncrier/test/test_format.py
Outdated
"towncrier", "templates/default.rst" | ||
).decode("utf8") | ||
|
||
fragments = split_fragments(fragments, definitions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use this ... in this way e have a hint that we don't care about fragments or definitions in this test and you don't need to look and see where and how they are created and how they are checked at the end.
fragments = split_fragments(fragments, definitions) | |
fragments = split_fragments(fragments={}, definitions=OrderedDict()) |
But for this tests it would be interesting to also have at least one definition and one fragment to increase the coverage and make it easy to compare the output for the case in which you run without a custom topline.
Fixes #180