Exemple #1
0
def pytest_funcarg__kn005(request):
    param_dict = copy.deepcopy(Default_Param)
    spec = {
        "param": {
            "logfilename": "kn005",
            "outdir": "/".join([DATA_DIR, "twletters"]),
            "paramfdir": "twletters",
            "paramfname": "twlkn005.json",
            "balls": ["twletters"]
        },
        "book": {
            "bookdir": "twletters",
            "bookId": "twletters"
        },
        "koma": {
            "komadir": 'k005',
            "komaId": 5,
            "komaIdStr": "005",
            "imgfname": "005.jpeg"
        },
        "page": {
            "imgfname": "005_0.jpeg"
        }
    }
    for k, v in param_dict.items():
        v.update(spec[k])
    ku.check_test_environment(param_dict, 'twletters')
    return KnParam(param_dict)
Exemple #2
0
def pytest_funcarg__b1g102(request):
    """
    両側とも全面挿絵のサンプル
    """
    param_dict = copy.deepcopy(Default_Param)
    spec = {
        "param": {
            "logfilename": "kn106",
            "outdir": "/".join([DATA_DIR, "b1g102"]),
            "paramfdir": "b1g102",
            "paramfname": "b1g102.json",
            "balls": ["b1g102"]
        },
        "book": {
            "bookdir": "b1g102",
            "bookId": "b1g102"
        },
        "koma": {
            "komadir": 'k106',
            "komaId": 106,
            "komaIdStr": "106",
            "imgfname": "106.jpeg"
        },
        "page": {
            "imgfname": "106_0.jpeg"
        }
    }
    for k, v in param_dict.items():
        v.update(spec[k])
    ku.check_test_environment(param_dict, 'b1g102')
    return KnParam(param_dict)
Exemple #3
0
def pytest_funcarg__knp(request):
    param_dict = copy.deepcopy(Default_Param)
    spec = {
        "param": {
            "logfilename": "kn021",
            "outdir": "/".join([DATA_DIR, "1091460"]),
            "paramfdir": "1091460",
            "paramfname": "knp.json",
            "balls": ["1091460"]
        },
        "book": {
            "bookdir": '1091460',
            "bookId": "1091460"
        },
        "koma": {
            "komadir": 'k001',
            "komaId": 1,
            "komaIdStr": "001",
            "imgfname": "001.jpeg"
        },
        "page": {
            "imgfname": "001_0.jpeg"
        }
    }
    for k, v in param_dict.items():
        v.update(spec[k])
    ku.check_test_environment(param_dict, '1091460')
    return KnParam(param_dict)
Exemple #4
0
def pytest_funcarg__graph2(request):
    """
    両側とも全面挿絵のサンプル
    """
    param_dict = copy.deepcopy(Default_Param)
    spec = {
        "param": {
            "logfilename": "kngraph2_009",
            "outdir": "/".join([DATA_DIR, "graph2"]),
            "paramfdir": "graph2",
            "paramfname": "kngraph2.json",
            "balls": ["graph2"]
        },
        "book": {
            "bookdir": "graph2",
            "bookId": "graph2"
        },
        "koma": {
            "komadir": 'k009',
            "komaId": 9,
            "komaIdStr": "009",
            "imgfname": "009.jpeg"
        },
        "page": {
            "imgfname": "009_0.jpeg",
        }
    }
    for k, v in param_dict.items():
        v.update(spec[k])
    ku.check_test_environment(param_dict, 'graph2')
    return KnParam(param_dict)
Exemple #5
0
def pytest_funcarg__b1g1012(request):
    """
    両側とも全面挿絵のサンプル
    """
    param_dict = copy.deepcopy(Default_Param)
    spec = {
        "param": {
            "logfilename": "kn021",
            "outdir": "/".join([DATA_DIR, "b1g101"]),
            "paramfdir": "b1g101",
            "paramfname": "b1g101.json",
            "balls": ["b1g101"]
        },
        "book": {
            "bookdir": 'b1g101',
            "bookId": "b1g101",
        },
        "koma": {
            "scale_size": 960.0,
            "komadir": 'k021',
            "komaId": 21,
            "komaIdStr": "021",
            "imgfname": "021.jpeg"
        },
        "page": {
            "imgfname": "021_0.jpeg",
        }
    }
    for k, v in param_dict.items():
        v.update(spec[k])
    ku.check_test_environment(param_dict, 'b1g1011')
    return KnParam(param_dict)
Exemple #6
0
def pytest_funcarg__knFewLines(request):
    param_dict = copy.deepcopy(Default_Param)
    spec = {
        "param": {
            "logfilename": "knF006",
            "outdir": "/".join([DATA_DIR, "1123003"]),
            "paramfdir": "1123003",
            "paramfname": "knMany006.json",
            "balls": ["1123003"]
        },
        "book": {
            "bookdir": "1123003",
            "bookId": "1123003"
        },
        "koma": {
            "scale_size": 320.0,
            "hough": [1, 180, 200],
            "canny": [50, 150, 3],
            "komadir": 'k006',
            "komaId": 7,
            "komaIdStr": "006",
            "imgfname": "006.jpeg"
        },
        "page": {
            "imgfname": "006_0.jpeg"
        }
    }
    for k, v in param_dict.items():
        v.update(spec[k])
    ku.check_test_environment(param_dict, '1123003')
    return KnParam(param_dict)
Exemple #7
0
def pytest_funcarg__kaiten(request):
    param_dict = copy.deepcopy(Default_Param)
    spec = {
        "param": {
            "logfilename": "kaiten",
            "outdir": "/".join([DATA_DIR, "1062973"]),
            "paramfdir": "1062973",
            "paramfname": "kaiten.json",
            "balls": ["kaiten"]
        },
        "book": {
            "bookdir": "1062973",
            "bookId": "1062973"
        },
        "koma": {
            "komadir": 'k008',
            "komaId": 8,
            "komaIdStr": "008",
            "imgfname": "008.jpeg"
        },
        "page": {
            "imgfname": "008_0.jpeg"
        }
    }
    for k, v in param_dict.items():
        v.update(spec[k])
    ku.check_test_environment(param_dict, 'kaiten')
    return KnParam(param_dict)
def pytest_funcarg__kn00900(request):
    param_dict = copy.deepcopy(Default_Param)
    spec = {
        "param": {
            "logfilename": "kn00900",
            "outdir":      "/".join([DATA_DIR, "1062973"]),
            "paramfdir":   "1062973/k009/00",
            "paramfname":  "knp.json",
            "balls":       ["1062973"]
        },
        "book": {
            "bookdir":      '1062973',
            "bookId":       "1062973"
        },
        "koma": {
            "komadir":      'k009',
            "komaId":       9,
            "komaIdStr":    "009",
            "imgfname":     "009.jpeg"
        },
        "page": {
            "pagedir":      '00',
            "imgfname":     "009_0.jpeg"
        }
    }
    for k, v in param_dict.items():
        v.update(spec[k])
    check_test_environment(param_dict, '1062973')
    knp = KnPage(params=KnParam(param_dict))
    return knp
    def test_all_page_out(self):
        for i in range(5, 45):
            for j in range(0, 2):
                param_dict = copy.deepcopy(Default_Param)
                spec = {
                    "param": {
                        "logfilename": "kn0{0:0>2}_0{1}".format(i, j),
                        "outdir": "/".join([DATA_DIR, "1062973"]),
                        "paramfdir": "1062973/k0{0:0>2}/0{1}".format(i, j),
                        "paramfname": "knp.json",
                        "balls": ["1062973"]
                    },
                    "book": {
                        "bookdir": '1062973',
                        "bookId": "1062973"
                    },
                    "koma": {
                        "komadir": "k0{0:0>2}".format(i),
                        "komaId": i,
                        "komaIdStr": "0{0:0>2}".format(i),
                        "imgfname": "0{0:0>2}.jpeg".format(i)
                    },
                    "page": {
                        "pagedir": "0{0}".format(j),
                        "imgfname": "0{0:0>2}_{1}.jpeg".format(i, j)
                    }
                }
                for k, v in param_dict.items():
                    v.update(spec[k])
                check_test_environment(param_dict, '1062973')
                knparam0 = KnParam(param_dict)
                assert knparam0 != None
                knpage0 = KnPage(params=knparam0)
                assert knpage0 != None

                fpath = write_collected_boxes_to_file(knpage0, "/".join([DATA_DIR, knparam0['param']['paramfdir']]))
                assert os.path.exists(fpath)

                fpath = write_original_with_collected_boxes_to_file(knpage0, "/".join([DATA_DIR, knparam0['param']['paramfdir']]))
                assert os.path.exists(fpath)
Exemple #10
0
def pytest_funcarg__knManyLines(request):
    param_dict = copy.deepcopy(Default_Param)
    spec = {
        "param": {
            "logfilename": "knM007",
            "outdir": "/".join([DATA_DIR, "1142178"]),
            "paramfdir": "1142178",
            "paramfname": "knMany007.json",
            "balls": ["1142178"]
        },
        "book": {
            "bookdir": "1142178",
            "bookId": "1142178"
        },
        "koma": {
            "scale_size": 320.0,
            "hough": [1, 2, 80],
            "canny": [50, 150, 3],
            "komadir": 'k007',
            "komaId": 7,
            "komaIdStr": "007",
            "imgfname": "007.jpeg",
            "small_zone_levels": {
                'upper': [0.03, 0.1],
                'lower': [0.9, 0.97],
                'center': [0.45, 0.55],
                'left': [0.03, 0.12],
                'right': [0.88, 0.97]
            }
        },
        "page": {
            "imgfname": "007_0.jpeg"
        }
    }
    for k, v in param_dict.items():
        v.update(spec[k])
    ku.check_test_environment(param_dict, '1142178')
    return KnParam(param_dict)