Check that these arguments, if supplied, are consistent. Return a (width, height) pair.
(size, width, height)
| 275 | |
| 276 | |
| 277 | def check_sizes(size, width, height): |
| 278 | """ |
| 279 | Check that these arguments, if supplied, are consistent. |
| 280 | Return a (width, height) pair. |
| 281 | """ |
| 282 | |
| 283 | if not size: |
| 284 | return width, height |
| 285 | |
| 286 | if len(size) != 2: |
| 287 | raise ProtocolError("size argument should be a pair (width, height)") |
| 288 | if width is not None and width != size[0]: |
| 289 | raise ProtocolError( |
| 290 | "size[0] (%r) and width (%r) should match when both are used." |
| 291 | % (size[0], width) |
| 292 | ) |
| 293 | if height is not None and height != size[1]: |
| 294 | raise ProtocolError( |
| 295 | "size[1] (%r) and height (%r) should match when both are used." |
| 296 | % (size[1], height) |
| 297 | ) |
| 298 | return size |
| 299 | |
| 300 | |
| 301 | def check_color(c, greyscale, which): |
no test coverage detected