| Conditions | 1 |
| Total Lines | 66 |
| Code Lines | 5 |
| 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 |
||
| 52 | def test_image(self): |
||
| 53 | self.verify_conversion( |
||
| 54 | """ |
||
| 55 | --- |
||
| 56 | pandoc-latex-absolute-image: |
||
| 57 | - classes: [left] |
||
| 58 | image: Tux.pdf |
||
| 59 | x-coord: 1cm |
||
| 60 | y-coord: 1cm |
||
| 61 | width: 1cm |
||
| 62 | - classes: [reset] |
||
| 63 | reset: true |
||
| 64 | --- |
||
| 65 | |||
| 66 | ::: left |
||
| 67 | Image at left position |
||
| 68 | ::: |
||
| 69 | |||
| 70 | \\newpage |
||
| 71 | |||
| 72 | ::: reset |
||
| 73 | No image |
||
| 74 | ::: |
||
| 75 | """, |
||
| 76 | """ |
||
| 77 | \\renewcommand\\PandocLaTeXAbsoluteImage{% |
||
| 78 | \\ifodd\\value{page}% |
||
| 79 | \\begin{tikzpicture}[ |
||
| 80 | overlay, % Do our drawing on an overlay instead of inline |
||
| 81 | remember picture, % Allow us to share coordinates with other drawings |
||
| 82 | shift=(current page.north west), % Set the top (north) left (west) as the origin |
||
| 83 | yscale=-1, % Switch the y-axis to increase down the page |
||
| 84 | inner sep=0, % Remove inner separator |
||
| 85 | ] |
||
| 86 | \\node[] at (1cm, 1cm) |
||
| 87 | {\\includegraphics[width=1cm]{Tux.pdf}}; |
||
| 88 | \\end{tikzpicture} |
||
| 89 | \\else |
||
| 90 | \\begin{tikzpicture}[ |
||
| 91 | overlay, % Do our drawing on an overlay instead of inline |
||
| 92 | remember picture, % Allow us to share coordinates with other drawings |
||
| 93 | shift=(current page.north west), % Set the top (north) left (west) as the origin |
||
| 94 | yscale=-1, % Switch the y-axis to increase down the page |
||
| 95 | inner sep=0, % Remove inner separator |
||
| 96 | ] |
||
| 97 | \\node[] at (1cm, 1cm) |
||
| 98 | {\\includegraphics[width=1cm]{Tux.pdf}}; |
||
| 99 | \\end{tikzpicture} |
||
| 100 | \\fi |
||
| 101 | } |
||
| 102 | |||
| 103 | Image at left position |
||
| 104 | |||
| 105 | \\newpage |
||
| 106 | |||
| 107 | \\renewcommand\\PandocLaTeXAbsoluteImage{% |
||
| 108 | \\ifodd\\value{page}% |
||
| 109 | |||
| 110 | \\else |
||
| 111 | |||
| 112 | \\fi |
||
| 113 | } |
||
| 114 | |||
| 115 | No image |
||
| 116 | """, |
||
| 117 | pandoc_latex_absolute_image.main, |
||
| 118 | ) |
||
| 119 |