Test helper checking that all values in the segment are correct, given a particular set of inputs.
(coll, positions, linelength, lineoffset, orientation)
| 270 | |
| 271 | |
| 272 | def check_segments(coll, positions, linelength, lineoffset, orientation): |
| 273 | """ |
| 274 | Test helper checking that all values in the segment are correct, given a |
| 275 | particular set of inputs. |
| 276 | """ |
| 277 | segments = coll.get_segments() |
| 278 | if (orientation.lower() == 'horizontal' |
| 279 | or orientation.lower() == 'none' or orientation is None): |
| 280 | # if horizontal, the position in is in the y-axis |
| 281 | pos1 = 1 |
| 282 | pos2 = 0 |
| 283 | elif orientation.lower() == 'vertical': |
| 284 | # if vertical, the position in is in the x-axis |
| 285 | pos1 = 0 |
| 286 | pos2 = 1 |
| 287 | else: |
| 288 | raise ValueError("orientation must be 'horizontal' or 'vertical'") |
| 289 | |
| 290 | # test to make sure each segment is correct |
| 291 | for i, segment in enumerate(segments): |
| 292 | assert segment[0, pos1] == lineoffset + linelength / 2 |
| 293 | assert segment[1, pos1] == lineoffset - linelength / 2 |
| 294 | assert segment[0, pos2] == positions[i] |
| 295 | assert segment[1, pos2] == positions[i] |
| 296 | |
| 297 | |
| 298 | def test_collection_norm_autoscale(): |
no test coverage detected
searching dependent graphs…