feature: urls as init images
- --init-image accepts urls - cleanup command line codepull/6/head
parent
47db34647b
commit
c7a822d701
@ -1,12 +0,0 @@
|
||||
def imagine_cmd(*args, **kwargs):
|
||||
from .suppress_logs import suppress_annoying_logs_and_warnings # noqa
|
||||
|
||||
suppress_annoying_logs_and_warnings()
|
||||
|
||||
from imaginairy.cmds import imagine_cmd as imagine_cmd_orig # noqa
|
||||
|
||||
imagine_cmd_orig(*args, **kwargs)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
imagine_cmd() # noqa
|
@ -0,0 +1,19 @@
|
||||
import pytest
|
||||
|
||||
from imaginairy import LazyLoadingImage
|
||||
from imaginairy.schema import InvalidUrlError
|
||||
from tests import TESTS_FOLDER
|
||||
|
||||
|
||||
def test_lazy_load_image():
|
||||
with pytest.raises(ValueError, match=r".*specify a url or filepath.*"):
|
||||
LazyLoadingImage()
|
||||
|
||||
with pytest.raises(FileNotFoundError, match=r".*File does not exist.*"):
|
||||
LazyLoadingImage(filepath="/tmp/bterpojirewpdfsn/ergqgr")
|
||||
|
||||
with pytest.raises(InvalidUrlError):
|
||||
LazyLoadingImage(url="/tmp/bterpojirewpdfsn/ergqgr")
|
||||
|
||||
img = LazyLoadingImage(filepath=f"{TESTS_FOLDER}/data/beach_at_sainte_adresse.jpg")
|
||||
assert img.size == (1686, 1246)
|
Loading…
Reference in New Issue