Ejemplo n.º 1
0
def lgtm(message: str, keyword: str) -> None:
    """画像のURL・パス・キーワードを指定して画像を取得してLGTMを行う関数。
    Args:
        message (str): 画像に描画するメッセージ
        keyword (str): 画像を取得するURL, ローカルパス, キーワード
    """
    fp = get_image(keyword)
    save_with_message(fp, message)
Ejemplo n.º 2
0
Archivo: core.py Proyecto: TUtaka/lgtm
def lgtm(keyword, message):
    with get_image(keyword) as fp:
        save_with_message(fp, message)
Ejemplo n.º 3
0
def lgtm(keyword, message):
    # ファイルオブジェクトはコンテキストマネージャ
    with get_image(keyword) as fp:
        save_with_message(fp, message)
Ejemplo n.º 4
0
def lgtm(keyword, message):
    # ここにロジックを追加していく
    with get_image(keyword) as fp:
        save_with_message(fp, message)
Ejemplo n.º 5
0
    def test_get_image(self):
        keyword = 'book'
        file = image_source.get_image(keyword)

        self.assertTrue(isinstance(file, io.BytesIO))
Ejemplo n.º 6
0
    def test_get_image(self):
        from lgtm.image_source import get_image

        with patch("lgtm.image_source.ImageSource") as mock:
            get_image("dog")
            mock.assert_called_once_with("dog")
Ejemplo n.º 7
0
Archivo: core.py Proyecto: hrkh/lgtm
def lgtm(keyword: str, message: str) -> None:
    with get_image(keyword) as fp:
        save_with_message(fp, message)