Пример #1
0
def test_cli_on_annotation_too_small():
    on_annotation = ONANNOTATIONS[1]
    with pytest.raises(wp.error.OnParamError):
        cli.main([
            METHODS[1], WSIS[0], ANNOTATIONS[0],
            "-oa", on_annotation
        ])
Пример #2
0
def test_cli_overlap_too_large():
    patch_height = patch_width = PATCH_SIZES[0]
    overlap_height = overlap_width = OVERLAP_SIZES[4]
    with pytest.raises(wp.error.SizeError):
        cli.main([
            METHODS[0], WSIS[0], "-pw", patch_width, "-ph", patch_height,
            "-ow", overlap_width, "-oh", overlap_height
        ])
Пример #3
0
def test_cli_pass():
    # should go without any errors
    cli.main([
        METHODS[0], WSIS[0], "-of", ONFOREGROUNDS[0], "-st", SAVE_TOS[0],
        "-pw", PATCH_SIZES[0], "-ph", PATCH_SIZES[0], "-ow", OVERLAP_SIZES[0],
        "-oh", OVERLAP_SIZES[0], "-ox", OFFSET_X[0], "-oy", OFFSET_Y[0], "-dw",
        DOT_BBOX_WIDTH[0], "-dh", DOT_BBOX_HEIGHT[0]
    ])
Пример #4
0
def test_cli_dot_to_bbox():
    # DOT_BBOX_WIDTH = (10, 0, 1000)
    dot_bbox_width = DOT_BBOX_WIDTH[1]
    with pytest.raises(wp.error.SizeError):
        cli.main([
            METHODS[2], WSIS[0], ANNOTATIONS[1],
            "-dw", dot_bbox_width
        ])
Пример #5
0
def test_cli_on_foreground():
    # ONFOREGROUNDS = (1.0, 0, 0.50000000001)
    on_foreground = ONFOREGROUNDS[1]
    with pytest.raises(wp.error.OnParamError):
        cli.main([
            METHODS[0], WSIS[0],
            "-of", on_foreground
        ])
Пример #6
0
def test_cli_patch_too_large():
    patch_height = patch_width = PATCH_SIZES[4]
    with pytest.raises(wp.error.SizeError):
        cli.main([
            METHODS[0], WSIS[0],
            "-pw", patch_width,
            "-ph", patch_height
        ])
Пример #7
0
def test_cli_save_to_root():
    # SAVE_TOS = (".", "/", "")
    save_to = SAVE_TOS[1]
    with pytest.raises(OSError):
        cli.main([
            METHODS[0], WSIS[0],
            "-st", save_to
        ])
Пример #8
0
def test_cli_rule_empty():
    # RULES = ("rule.json", "test_emptyfile.txt")
    rule = RULES[1]
    with pytest.raises(json.decoder.JSONDecodeError):
        cli.main([
            METHODS[1], WSIS[0], ANNOTATIONS[0],
            "-ru", rule
        ])
Пример #9
0
def test_cli_offset_too_large():
    offset_x = OFFSET_X[2]
    offset_y = OFFSET_Y[2]
    with pytest.raises(wp.error.SizeError):
        cli.main([
            METHODS[0], WSIS[0],
            "-ox", offset_x,
            "-oy", offset_y
        ])
Пример #10
0
def test_cli_patch_too_small():
    # PATCH_SIZES = (256, 0, 1, 0.1, 1048576)
    patch_height = patch_width = PATCH_SIZES[1]
    with pytest.raises(wp.error.SizeError):
        cli.main([
            METHODS[0], WSIS[0],
            "-pw", patch_width,
            "-ph", patch_height
        ])
Пример #11
0
def test_cli_annotation_emptyfile():
    """
    ANNOTATIONS = (
        "CMU-1_classification.xml",
        "CMU-1_detection.xml",
        "CMU-1_segmentation.xml",
        "test_emptyfile.txt")
    """
    method = METHODS[1]
    annotation = ANNOTATIONS[3]
    cli.main([method, WSIS[0], annotation])
Пример #12
0
def test_cli_segmentation_without_annotation():
    method = METHODS[3]
    with pytest.raises(SystemExit):
        cli.main([method, WSIS[0]])
Пример #13
0
def test_cli_method_segmentation():
    method = METHODS[2]
    annotation = ANNOTATIONS[2]
    cli.main([method, WSIS[0], annotation])
Пример #14
0
def test_cli_method_notimplemented():
    # METHODS = ("none", "Classification", "Detection", "Segmentation", "foo")
    method = METHODS[3]
    # argparse does not catch invalid choice as Errors.
    cli.main([method, WSIS[0], ANNOTATIONS[0]])
Пример #15
0
def test_cli_method_none():
    method = METHODS[0]
    cli.main([method, WSIS[0]])
Пример #16
0
def test_cli_method_detection():
    method = METHODS[1]
    annotation = ANNOTATIONS[1]
    cli.main([method, WSIS[0], annotation])
Пример #17
0
def test_cli_wsi_corrupted():
    wsi = WSIS[2]
    with pytest.raises(openslide.lowlevel.OpenSlideUnsupportedFormatError):
        cli.main([METHODS[0], wsi])
Пример #18
0
def test_cli_wsi_blank():
    wsi = WSIS[1]
    with pytest.raises(wp.error.SlideLoadError):
        cli.main([METHODS[0], wsi])
Пример #19
0
def test_cli_none_with_annotation():
    method = METHODS[0]
    annotation = ANNOTATIONS[0]
    with pytest.raises(SystemExit):
        cli.main([method, WSIS[0], annotation])
Пример #20
0
def test_verbose():
    cli.main([METHODS[0], WSIS[0], "-ve"])
    cli.main([METHODS[1], WSIS[0], ANNOTATIONS[0], "-ve"])

    cli.main([METHODS[0], WSIS[0]])
    cli.main([METHODS[1], WSIS[0], ANNOTATIONS[0]])
Пример #21
0
def test_cli_classification_without_annotation():
    method = METHODS[1]
    with pytest.raises(SystemExit):
        cli.main([method, WSIS[0]])