def test_fail_geometry():
    with pytest.raises(ValueError, match="invalid"):
        parser.geometry("a xylophone")  # word with x to emulate form
    with pytest.raises(ValueError, match="invalid"):
        parser.geometry("200xnot_a_number")
    with pytest.raises(ValueError, match="invalid"):
        parser.geometry("12xnot_a_number")
    with pytest.raises(argparse.ArgumentTypeError, match="form WIDTHxHEIGHT"):
        parser.geometry("1000")
    with pytest.raises(argparse.ArgumentTypeError, match="must be positive"):
        parser.geometry("-100x200")
Exemplo n.º 2
0
def ensure_size_not(size, image):
    expected = geometry(size)
    image_rect = image.sceneRect()
    width_neq = expected.width() != image_rect.width()
    height_neq = expected.height() != image_rect.height()
    assert width_neq or height_neq
def test_geometry():
    text = "300x500"
    parsed_value = parser.geometry(text)
    assert parsed_value == QSize(300, 500)
Exemplo n.º 4
0
def ensure_size(size, image):
    expected = geometry(size)
    image_rect = image.sceneRect()
    assert expected.width() == image_rect.width()
    assert expected.height() == image_rect.height()