-
Notifications
You must be signed in to change notification settings - Fork 7.1k
add: constructor injection #186
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
Conversation
tested as single file testrun with Python 2.7 only
Codecov Report
@@ Coverage Diff @@
## master #186 +/- ##
==========================================
+ Coverage 94.51% 94.59% +0.07%
==========================================
Files 55 57 +2
Lines 2333 2366 +33
==========================================
+ Hits 2205 2238 +33
Misses 128 128
Continue to review full report at Codecov.
|
|
ready for review |
|
|
||
| def get_current_time_as_html_fragment(self): | ||
| current_time = self.time_provider.now() | ||
| current_time_as_html_fragment = "<span class=\"tinyBoldText\">" + current_time + "</span>" |
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.
It's better to use .format here instead of + (true for all string concatenations that you do)
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.
DONE
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.
Thanks but that's not what I meant. The idea is to avoid string concatenations completely since a) strings are immutable and there is some overhead included, b) it is more idiomatic in Python to use .format. The idea looks like that: "<span class=\"tinyBoldText\">{}{}</span>".format(current_time.hour, current_time.minute)
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.
Isn't that exactly what I changed in commit 4cca032?
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.
Oops, sorry, I missed that :)
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.
It is already late 😉
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.
thanks for reviewing
quick and dirty implementation (needs some cleanup) in a new subdirectory for "design for testability" patterns. tested as single file testrun with Python 2.7 only (just let travis do the job...)