Add new unit tests for djblets.siteconfig
Review Request #7884 — Created Jan. 16, 2016 and submitted
Add new unit tests for djblets.siteconfig
This is a unit test.
I have runned it. All cases are passed.
Description | From | Last Updated |
---|---|---|
I suspect this can / should probably be broken up into several smaller test methods on this class - one … |
mike_conley | |
Col: 9 E265 block comment should start with '# ' |
reviewbot | |
Col: 62 E231 missing whitespace after ',' |
reviewbot | |
Col: 70 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
Col: 72 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
Might as well do: self.assertEqual(self.siteconfig.get('invalidKey', default=2), 2) self.siteconfig.add_default('validKey2', 'validParameter2') self.assertEqual(self.siteconfig.get('validKey2'), 'validParameter2') and so on - that way, you don't need … |
mike_conley | |
Col: 44 E231 missing whitespace after ',' |
reviewbot | |
Col: 48 E231 missing whitespace after ',' |
reviewbot | |
Col: 44 E231 missing whitespace after ',' |
reviewbot | |
Col: 40 E231 missing whitespace after ',' |
reviewbot | |
Col: 44 E231 missing whitespace after ',' |
reviewbot | |
Col: 9 E265 block comment should start with '# ' |
reviewbot | |
Col: 40 E231 missing whitespace after ',' |
reviewbot | |
Col: 38 E231 missing whitespace after ',' |
reviewbot | |
Col: 46 E231 missing whitespace after ',' |
reviewbot | |
Col: 55 E231 missing whitespace after ',' |
reviewbot | |
Col: 9 E265 block comment should start with '# ' |
reviewbot | |
Col: 34 E231 missing whitespace after ',' |
reviewbot | |
Col: 47 E231 missing whitespace after ',' |
reviewbot | |
Col: 9 E265 block comment should start with '# ' |
reviewbot | |
Col: 48 E231 missing whitespace after ',' |
reviewbot | |
Col: 58 E231 missing whitespace after ',' |
reviewbot | |
Col: 9 E265 block comment should start with '# ' |
reviewbot | |
Col: 50 E231 missing whitespace after ',' |
reviewbot | |
Col: 50 E231 missing whitespace after ',' |
reviewbot | |
Col: 50 E231 missing whitespace after ',' |
reviewbot | |
Col: 67 W292 no newline at end of file |
reviewbot | |
Col: 71 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
Col: 73 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
Col: 34 E231 missing whitespace after ',' |
reviewbot | |
Col: 68 W292 no newline at end of file |
reviewbot | |
Each of these tests should have a docstring in the form of: """Testing SiteConfiguration.get with <testing conditions>""" If they need … |
chipx86 | |
We use under_scores instead of CamelCase. For this, though, I'd just go with a variable name of value, since it's … |
chipx86 | |
Each thing you're testing should be its own function. That way, if something regresses, we'll see how many of the … |
chipx86 | |
This would actually be more concise and safer as: self.assertEqual( siteconfig.settings, { 'validKey3': 'validParameter3', 'validKey4': 'validParameter4', }) |
chipx86 | |
Blank line between these (between code and blocks, or code and other code doing something different -- think of it … |
chipx86 | |
You can define this as one statement. |
chipx86 | |
Same here. |
chipx86 | |
This test shouldn't pass because you aren't doing self.siteconfig.add_defaults. Make sure to run the unit test suite (./tests/runtests.py). |
brennie | |
Col: 80 E501 line too long (90 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (81 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (81 > 79 characters) |
reviewbot | |
Col: 52 W291 trailing whitespace |
reviewbot | |
Col: 26 E231 missing whitespace after ':' |
reviewbot | |
Col: 26 E231 missing whitespace after ':' |
reviewbot | |
Col: 26 E231 missing whitespace after ':' |
reviewbot | |
Col: 80 E501 line too long (81 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (85 > 79 characters) |
reviewbot | |
Col: 26 E231 missing whitespace after ':' |
reviewbot | |
Col: 26 E231 missing whitespace after ':' |
reviewbot | |
Col: 26 E231 missing whitespace after ':' |
reviewbot | |
Col: 67 W291 trailing whitespace |
reviewbot | |
Col: 48 W291 trailing whitespace |
reviewbot | |
Col: 48 W291 trailing whitespace |
reviewbot | |
Col: 52 W291 trailing whitespace |
reviewbot | |
Col: 22 W291 trailing whitespace |
reviewbot | |
Col: 48 W291 trailing whitespace |
reviewbot | |
Col: 48 W291 trailing whitespace |
reviewbot | |
Remove the period. The test runner will add one. |
brennie | |
No period. |
brennie | |
When the parameters aren't long, you can format as: self.assertEqual(self.siteconfig.get('valid_key_1'), 'valid_parameter_1') |
brennie | |
No period. |
brennie | |
Same note about formatting. |
brennie | |
No period. |
brennie | |
Same note about formatting. |
brennie | |
Same not about formatting. |
brennie | |
Col: 80 E501 line too long (86 > 79 characters) |
reviewbot |
-
-
I suspect this can / should probably be broken up into several smaller test methods on this class - one for each of the sections that you're demarking with a comment.
-
Might as well do:
self.assertEqual(self.siteconfig.get('invalidKey', default=2), 2) self.siteconfig.add_default('validKey2', 'validParameter2') self.assertEqual(self.siteconfig.get('validKey2'), 'validParameter2')
and so on - that way, you don't need the intermediate variables.
- Groups:
-
Tool: Pyflakes Processed Files: djblets/siteconfig/tests.py Tool: PEP8 Style Checker Processed Files: djblets/siteconfig/tests.py
-
-
-
-
-
Tool: Pyflakes Processed Files: djblets/siteconfig/tests.py Tool: PEP8 Style Checker Processed Files: djblets/siteconfig/tests.py
-
-
Each of these tests should have a docstring in the form of:
"""Testing SiteConfiguration.get with <testing conditions>"""
If they need to wrap, do:
"""Testing SiteConfiguration.get with <testing conditions> """
-
We use under_scores instead of CamelCase.
For this, though, I'd just go with a variable name of
value
, since it's more clear as to what it is, and short enough to read clearly. -
Each thing you're testing should be its own function. That way, if something regresses, we'll see how many of the functions failed and have a better sense as to what may have gone wrong.
Same with the others below.
-
This would actually be more concise and safer as:
self.assertEqual( siteconfig.settings, { 'validKey3': 'validParameter3', 'validKey4': 'validParameter4', })
-
Blank line between these (between code and blocks, or code and other code doing something different -- think of it like paragraphs in a story).
-
-
-
Tool: Pyflakes Processed Files: djblets/siteconfig/tests.py Tool: PEP8 Style Checker Processed Files: djblets/siteconfig/tests.py
-
-
-
-
-
-
-
-
-
-
-
-
-
Tool: Pyflakes Processed Files: djblets/siteconfig/tests.py Tool: PEP8 Style Checker Processed Files: djblets/siteconfig/tests.py
-
-
-
-
-
-
-
-
Tool: Pyflakes Processed Files: djblets/siteconfig/tests.py Tool: PEP8 Style Checker Processed Files: djblets/siteconfig/tests.py
-
This looks great! Just a few formatting nitpicks and then LGTM :)
You can replace your testing done with:
Ran unit tests.
That is sufficient for mentioning tests in all patches (unless there are extenuating circumstances).
-
-
-
When the parameters aren't long, you can format as:
self.assertEqual(self.siteconfig.get('valid_key_1'), 'valid_parameter_1')
-
-
-
-
-
-
Tool: Pyflakes Processed Files: djblets/siteconfig/tests.py Tool: PEP8 Style Checker Processed Files: djblets/siteconfig/tests.py