| Conditions | 1 |
| Total Lines | 55 |
| Code Lines | 39 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | # -*- coding: utf-8 -*- |
||
| 120 | def describe_meta(): |
||
| 121 | |||
| 122 | def it_displays_help_information(cli): |
||
| 123 | cmd = cli('--help') |
||
| 124 | |||
| 125 | expect(cmd.stdout).contains("usage: verchew") |
||
| 126 | expect(cmd.returncode) == 0 |
||
| 127 | |||
| 128 | def it_displays_version_information(cli): |
||
| 129 | cmd = cli('--version') |
||
| 130 | |||
| 131 | expect(cmd.stdout or cmd.stderr).contains("verchew v1.") |
||
| 132 | expect(cmd.returncode) == 0 |
||
| 133 | |||
| 134 | def describe_init(): |
||
| 135 | |||
| 136 | def it_generates_a_sample_config(cli): |
||
| 137 | cmd = cli('--init') |
||
| 138 | |||
| 139 | expect(cmd.stderr) == "" |
||
| 140 | expect(cmd.stdout).contains("Checking for Make") |
||
| 141 | expect(cmd.returncode) == 0 |
||
| 142 | |||
| 143 | def describe_main(): |
||
| 144 | |||
| 145 | @pytest.mark.skipif( |
||
| 146 | sys.version_info[0] == 2 or sys.platform == 'win32', |
||
| 147 | reason="unix and python3 only", |
||
| 148 | ) |
||
| 149 | def it_displays_results_on_unix_python_3(cli): |
||
| 150 | cmd = cli('--root', EXAMPLES_DIR) |
||
| 151 | |||
| 152 | expect(cmd.stderr) == "" |
||
| 153 | expect(cmd.stdout) == STYLED_OUTPUT |
||
| 154 | expect(cmd.returncode) == 0 |
||
| 155 | |||
| 156 | @pytest.mark.skipif( |
||
| 157 | sys.version_info[0] == 3 or sys.platform == 'win32', |
||
| 158 | reason="unix and python2 only", |
||
| 159 | ) |
||
| 160 | def it_displays_results_on_unix_python_2(cli): |
||
| 161 | cmd = cli('--root', EXAMPLES_DIR) |
||
| 162 | |||
| 163 | expect(cmd.stderr) == "" |
||
| 164 | expect(cmd.stdout) == UNSTYLED_OUTPUT |
||
| 165 | expect(cmd.returncode) == 0 |
||
| 166 | |||
| 167 | @pytest.mark.skipif(sys.platform != 'win32', reason="windows only") |
||
| 168 | def it_displays_results_on_windows(cli): |
||
| 169 | cmd = cli('--root', EXAMPLES_DIR) |
||
| 170 | |||
| 171 | expect(cmd.stderr) == "" |
||
| 172 | expect(cmd.stdout) == UNSTYLED_OUTPUT_WINDOWS |
||
| 173 | expect(cmd.returncode) == 0 |
||
| 174 | |||
| 175 | def it_exits_with_an_error_code_if_enabled(cli): |
||
| 216 |