| Conditions | 1 |
| Total Lines | 130 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 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 | import unittest |
||
| 13 | def setUp(self): |
||
| 14 | self.config = testing.setUp() |
||
| 15 | self.max_area = 5 |
||
| 16 | |||
| 17 | self.geometrie = GeometrieSchemaNode(max_area=5) |
||
| 18 | |||
| 19 | self.geojson_valid = { |
||
| 20 | "type": "MultiPolygon", |
||
| 21 | "coordinates": [[[[152184.01399999947, 212331.8648750011], [152185.94512499947, 212318.6137500011], |
||
| 22 | [152186.13837499946, 212318.6326250011], [152186.86699999947, 212313.9570000011], |
||
| 23 | [152186.91462499945, 212313.65187500112], [152192.45099999948, 212314.2943750011], |
||
| 24 | [152190.69212499948, 212319.2656250011], [152199.58799999946, 212319.5248750011], |
||
| 25 | [152197.85312499947, 212327.9388750011], [152197.57199999946, 212327.8978750011], |
||
| 26 | [152197.08099999945, 212333.2668750011], [152184.01399999947, 212331.8648750011]]]], |
||
| 27 | "crs": { |
||
| 28 | "type": "name", |
||
| 29 | "properties": { |
||
| 30 | "name": "urn:ogc:def:crs:EPSG::31370" |
||
| 31 | } |
||
| 32 | } |
||
| 33 | } |
||
| 34 | self.geojson_invalid_type = { |
||
| 35 | "type": "InvalidType", |
||
| 36 | "coordinates": [ |
||
| 37 | [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], |
||
| 38 | [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], |
||
| 39 | [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] |
||
| 40 | ], |
||
| 41 | "crs": { |
||
| 42 | "type": "name", |
||
| 43 | "properties": { |
||
| 44 | "name": "urn:ogc:def:crs:EPSG::31370" |
||
| 45 | } |
||
| 46 | } |
||
| 47 | } |
||
| 48 | self.geojson_geom_not_in_flanders = { |
||
| 49 | "type": "MultiPolygon", |
||
| 50 | "coordinates": [ |
||
| 51 | [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], |
||
| 52 | [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], |
||
| 53 | [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] |
||
| 54 | ], |
||
| 55 | "crs": { |
||
| 56 | "type": "name", |
||
| 57 | "properties": { |
||
| 58 | "name": "urn:ogc:def:crs:EPSG::31370" |
||
| 59 | } |
||
| 60 | } |
||
| 61 | } |
||
| 62 | self.geojson_point = { |
||
| 63 | "type": "Point", |
||
| 64 | "coordinates": [102.0, 2.0], |
||
| 65 | "crs": { |
||
| 66 | "type": "name", |
||
| 67 | "properties": { |
||
| 68 | "name": "urn:ogc:def:crs:EPSG::31370" |
||
| 69 | } |
||
| 70 | } |
||
| 71 | } |
||
| 72 | self.geojson_srid_4326 = { |
||
| 73 | "type": "MultiPolygon", |
||
| 74 | "coordinates": [[[[152184.01399999947, 212331.8648750011], [152185.94512499947, 212318.6137500011], |
||
| 75 | [152186.13837499946, 212318.6326250011], [152186.86699999947, 212313.9570000011], |
||
| 76 | [152186.91462499945, 212313.65187500112], [152192.45099999948, 212314.2943750011], |
||
| 77 | [152190.69212499948, 212319.2656250011], [152199.58799999946, 212319.5248750011], |
||
| 78 | [152197.85312499947, 212327.9388750011], [152197.57199999946, 212327.8978750011], |
||
| 79 | [152197.08099999945, 212333.2668750011], [152184.01399999947, 212331.8648750011]]]], |
||
| 80 | "crs": { |
||
| 81 | "type": "name", |
||
| 82 | "properties": { |
||
| 83 | "name": "urn:ogc:def:crs:EPSG::4326" |
||
| 84 | } |
||
| 85 | } |
||
| 86 | } |
||
| 87 | self.geojson_invalid_geom = { |
||
| 88 | "type": "MultiPolygon", |
||
| 89 | "coordinates": [[[[152184.01399999947, 212331.8648750011],[152184.01399999947, 212331.8648750010], |
||
| 90 | [152184.01399999947, 212331.8648750010]]]], |
||
| 91 | "crs": { |
||
| 92 | "type": "name", |
||
| 93 | "properties": { |
||
| 94 | "name": "urn:ogc:def:crs:EPSG::31370" |
||
| 95 | } |
||
| 96 | } |
||
| 97 | } |
||
| 98 | self.geojson_invalid_type_no_crs = { |
||
| 99 | "type": "MultiPolygon", |
||
| 100 | "coordinates": [[[[152184.01399999947, 212331.8648750011], [152185.94512499947, 212318.6137500011], |
||
| 101 | [152186.13837499946, 212318.6326250011], [152186.86699999947, 212313.9570000011], |
||
| 102 | [152186.91462499945, 212313.65187500112], [152192.45099999948, 212314.2943750011], |
||
| 103 | [152190.69212499948, 212319.2656250011], [152199.58799999946, 212319.5248750011], |
||
| 104 | [152197.85312499947, 212327.9388750011], [152197.57199999946, 212327.8978750011], |
||
| 105 | [152197.08099999945, 212333.2668750011], [152184.01399999947, 212331.8648750010]]]], |
||
| 106 | } |
||
| 107 | self.geojson_intersecting_geom = { |
||
| 108 | "type": "MultiPolygon", |
||
| 109 | "coordinates": [[[[136311.36331804123, 189479.80567278434], [136330.70361803696, 189482.001472787], |
||
| 110 | [136330.25991803684, 189485.51207278483], [136312.9926180562, 189622.26197274867], |
||
| 111 | [136309.1386180551, 189621.94727274682], [136287.7971180621, 189620.205472745], |
||
| 112 | [136299.8650180514, 189546.03157276567], [136303.254718051, 189525.19737276994], |
||
| 113 | [136303.72911804935, 189522.28157277592], [136303.86311804503, 189521.45807277132], |
||
| 114 | [136304.32241804857, 189518.63487277366], [136305.1149180444, 189513.7637727782], |
||
| 115 | [136305.38571804608, 189512.09917277843], [136310.10041803963, 189483.12087278347], |
||
| 116 | [136310.65291804122, 189479.72507278528], [136311.36331804123, 189479.80567278434]]], |
||
| 117 | [[[136337.15461803263, 189483.00437278394], [136336.6959180319, 189486.44747278653], |
||
| 118 | [136328.27671804628, 189549.64527276624], [136390.48041802715, 189555.04837277252], |
||
| 119 | [136380.7150180388, 189628.1505727535], [136349.4110180502, 189625.37497274857], |
||
| 120 | [136329.42661805183, 189623.6030727476], [136312.9926180562, 189622.26197274867], |
||
| 121 | [136330.25991803684, 189485.51207278483], [136330.70361803696, 189482.001472787], |
||
| 122 | [136337.15461803263, 189483.00437278394]]]], |
||
| 123 | "crs": { |
||
| 124 | "type": "name", |
||
| 125 | "properties": { |
||
| 126 | "name": "urn:ogc:def:crs:EPSG::31370" |
||
| 127 | } |
||
| 128 | } |
||
| 129 | } |
||
| 130 | self.geojson_very_large = { |
||
| 131 | "type": "MultiPolygon", |
||
| 132 | "coordinates": [[[ |
||
| 133 | [149287.72860779167967848, 218916.39169927779585123], |
||
| 134 | [153788.90851591509999707, 182097.94758232310414314], |
||
| 135 | [220400.85877580623491667, 180574.3110011201351881], |
||
| 136 | [220400.85877580623491667, 180574.3110011201351881], |
||
| 137 | [149287.72860779167967848, 218916.39169927779585123] |
||
| 138 | ]]], |
||
| 139 | "crs": { |
||
| 140 | "type": "name", |
||
| 141 | "properties": { |
||
| 142 | "name": "urn:ogc:def:crs:EPSG::31370" |
||
| 143 | } |
||
| 282 |