Conditions | 1 |
Total Lines | 76 |
Code Lines | 6 |
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 | from unittest import TestCase |
||
181 | def test_referencing_caption_latex(self): |
||
182 | verify_conversion( |
||
183 | self, |
||
184 | r""" |
||
185 | --- |
||
186 | pandoc-numbering: |
||
187 | exercise: |
||
188 | general: |
||
189 | cite-shortcut: True |
||
190 | latex: |
||
191 | format-caption-classic: '%D %d %g %s %n %c %p' |
||
192 | format-caption-title: '%D %d %T %t %g %s %n %c %p' |
||
193 | --- |
||
194 | |||
195 | Title |
||
196 | ===== |
||
197 | |||
198 | Exercise -.#first |
||
199 | |||
200 | Exercise (Title) -.#second |
||
201 | |||
202 | See @exercise:first |
||
203 | |||
204 | See @exercise:second |
||
205 | """, |
||
206 | r""" |
||
207 | --- |
||
208 | header-includes: |
||
209 | - | |
||
210 | ` |
||
211 | \makeatletter |
||
212 | \@ifpackageloaded{subfig}{ |
||
213 | \usepackage[subfigure]{tocloft} |
||
214 | }{ |
||
215 | \usepackage{tocloft} |
||
216 | } |
||
217 | \makeatother |
||
218 | `{=tex} |
||
219 | - "`\\usepackage{etoolbox}`{=tex}" |
||
220 | - "`\\ifdef{\\mainmatter}{\\let\\oldmainmatter\\mainmatter\\renewcommand{\\mainmatter}[0]{\\oldmainmatter}}{}`{=tex}" |
||
221 | pandoc-numbering: |
||
222 | exercise: |
||
223 | general: |
||
224 | cite-shortcut: true |
||
225 | latex: |
||
226 | format-caption-classic: "%D %d %g %s %n %c %p" |
||
227 | format-caption-title: "%D %d %T %t %g %s %n %c %p" |
||
228 | --- |
||
229 | |||
230 | ` |
||
231 | \makeatletter |
||
232 | \@ifpackageloaded{subfig}{ |
||
233 | \usepackage[subfigure]{tocloft} |
||
234 | }{ |
||
235 | \usepackage{tocloft} |
||
236 | } |
||
237 | \makeatother |
||
238 | `{=tex} |
||
239 | |||
240 | `\usepackage{etoolbox}`{=tex} |
||
241 | |||
242 | `\ifdef{\mainmatter}{\let\oldmainmatter\mainmatter\renewcommand{\mainmatter}[0]{\oldmainmatter}}{}`{=tex} |
||
243 | |||
244 | `\ifdef{\mainmatter}{}{}`{=tex} |
||
245 | |||
246 | # Title |
||
247 | |||
248 | `\phantomsection\addcontentsline{exercise}{exercise}{\protect\numberline {1.1}{\ignorespaces {Exercise}}}`{=tex}[]{#exercise:title.1}[**Exercise 1**]{#exercise:first .pandoc-numbering-text .exercise .exercise-1-1 .exercise-first} |
||
249 | |||
250 | `\phantomsection\addcontentsline{exercise}{exercise}{\protect\numberline {1.2}{\ignorespaces {Title}}}`{=tex}[]{#exercise:title.title}[**Exercise 2** *(Title)*]{#exercise:second .pandoc-numbering-text .exercise .exercise-1-2 .exercise-second} |
||
251 | |||
252 | See [[Exercise 1]{.pandoc-numbering-link .exercise}](#exercise:first "Exercise exercise 1.1 1 1 2 \pageref{exercise:first}") |
||
253 | |||
254 | See [[Exercise 2 (Title)]{.pandoc-numbering-link .exercise}](#exercise:second "Exercise exercise Title title 1.2 1 2 2 \pageref{exercise:second}") |
||
255 | """, |
||
256 | "latex", |
||
257 | ) |
||
258 |