def test_save_with_message(self): from lgtm.drawer import save_with_message path = os.path.dirname(__file__) + "/data/test_image.jpg" with open(path, "rb") as f: save_with_message(f, "DOG") output_path = Path(OUTPUT_NAME) self.assertTrue(output_path.exists())
def lgtm(keyword, message): with get_image(keyword) as fp: save_with_message(fp, message)
def lgtm(keyword, message): # ファイルオブジェクトはコンテキストマネージャ with get_image(keyword) as fp: save_with_message(fp, message)
def lgtm(keyword, message): # ここにロジックを追加していく with get_image(keyword) as fp: save_with_message(fp, message)
def lgtm(keyword: str, message: str) -> None: with get_image(keyword) as fp: save_with_message(fp, message)