| Conditions | 1 | 
| Total Lines | 60 | 
| Code Lines | 51 | 
| 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 | """Module to test the KytosGraph in graph.py."""  | 
            ||
| 144 | @staticmethod  | 
            ||
| 145 | def generate_topology():  | 
            ||
| 146 | """Generates a predetermined topology"""  | 
            ||
| 147 |         switches = {} | 
            ||
| 148 |         interfaces = {} | 
            ||
| 149 |         links = {} | 
            ||
| 150 | |||
| 151 |         TestSearchResults.create_switch("User1", switches) | 
            ||
| 152 | TestSearchResults.add_interfaces(3, switches["User1"], interfaces)  | 
            ||
| 153 | |||
| 154 |         TestSearchResults.create_switch("S2", switches) | 
            ||
| 155 | TestSearchResults.add_interfaces(2, switches["S2"], interfaces)  | 
            ||
| 156 | |||
| 157 |         TestSearchResults.create_switch("User2", switches) | 
            ||
| 158 | TestSearchResults.add_interfaces(3, switches["User2"], interfaces)  | 
            ||
| 159 | |||
| 160 |         TestSearchResults.create_switch("S4", switches) | 
            ||
| 161 | TestSearchResults.add_interfaces(4, switches["S4"], interfaces)  | 
            ||
| 162 | |||
| 163 |         TestSearchResults.create_switch("S5", switches) | 
            ||
| 164 | TestSearchResults.add_interfaces(2, switches["S5"], interfaces)  | 
            ||
| 165 | |||
| 166 |         TestSearchResults.create_link("User1:1", "S2:1", interfaces, links) | 
            ||
| 167 |         TestSearchResults.create_link("User1:2", "S5:1", interfaces, links) | 
            ||
| 168 |         TestSearchResults.create_link("User1:3", "S4:1", interfaces, links) | 
            ||
| 169 |         TestSearchResults.create_link("S2:2", "User2:1", interfaces, links) | 
            ||
| 170 |         TestSearchResults.create_link("User2:2", "S4:2", interfaces, links) | 
            ||
| 171 |         TestSearchResults.create_link("S5:2", "S4:3", interfaces, links) | 
            ||
| 172 |         TestSearchResults.create_link("User2:3", "S4:4", interfaces, links) | 
            ||
| 173 | |||
| 174 | TestSearchResults.add_metadata_to_link(  | 
            ||
| 175 |             "User1:1", "S2:1", { | 
            ||
| 176 | "reliability": 3, "ownership": "B", "delay": 30,  | 
            ||
| 177 | "bandwidth": 20}, links)  | 
            ||
| 178 | TestSearchResults.add_metadata_to_link(  | 
            ||
| 179 |             "User1:2", "S5:1", { | 
            ||
| 180 | "reliability": 1, "ownership": "A", "delay": 5,  | 
            ||
| 181 | "bandwidth": 50}, links)  | 
            ||
| 182 | TestSearchResults.add_metadata_to_link(  | 
            ||
| 183 |             "User1:3", "S4:1", { | 
            ||
| 184 | "reliability": 3, "ownership": "A", "delay": 60,  | 
            ||
| 185 | "bandwidth": 10}, links)  | 
            ||
| 186 | TestSearchResults.add_metadata_to_link(  | 
            ||
| 187 |             "S2:2", "User2:1", { | 
            ||
| 188 | "reliability": 3, "ownership": "B", "delay": 30,  | 
            ||
| 189 | "bandwidth": 20}, links)  | 
            ||
| 190 | TestSearchResults.add_metadata_to_link(  | 
            ||
| 191 |             "User2:2", "S4:2", { | 
            ||
| 192 | "reliability": 3, "ownership": "B", "delay": 30,  | 
            ||
| 193 | "bandwidth": 10}, links)  | 
            ||
| 194 | TestSearchResults.add_metadata_to_link(  | 
            ||
| 195 |             "S5:2", "S4:3", { | 
            ||
| 196 | "reliability": 1, "ownership": "A", "delay": 10,  | 
            ||
| 197 | "bandwidth": 50}, links)  | 
            ||
| 198 | TestSearchResults.add_metadata_to_link(  | 
            ||
| 199 |             "User2:3", "S4:4", { | 
            ||
| 200 | "reliability": 3, "ownership": "A", "delay": 29,  | 
            ||
| 201 | "bandwidth": 20}, links)  | 
            ||
| 202 | |||
| 203 | return (switches, links)  | 
            ||
| 204 |