def testSaveConfig(): cf = TEST_CONF sd = ScaleDetection() sd.x_scale = SCALE[0] sd.y_scale = SCALE[1] sd.units = UNIT sd.saveConfigFile(config_file=cf) with open(cf, 'r') as conf: j = json.load(conf) assert j["x_scale"] == sd.x_scale assert j["y_scale"] == sd.y_scale assert j["units"] == UNIT
def testScales(): for i in range(0, len(FILENAMES)): sd = ScaleDetection() sd.x_scale = SCALE[0] sd.y_scale = SCALE[1] sd.units = UNIT im = sd.openImage(FILENAMES[i]) w,h,unit = sd.getSize(im, show_conts=SAVE_IMG) print "Width: {}".format(round(w,1)) print "Height: {}".format(round(h,1)) assert round(w, 1) == round(DIMS[i][0], 1) assert round(h, 1) == round(DIMS[i][1], 1)