Skip to content

Commit

Permalink
doctest SKIP all fails due to PIL.ImageFont()
Browse files Browse the repository at this point in the history
  • Loading branch information
Tam-Pham committed Sep 3, 2020
1 parent c5f3daa commit 83513b2
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 17 deletions.
5 changes: 2 additions & 3 deletions pyllusion/illusion/autostereogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ def autostereogram(stimulus="Hello", pattern=None, n_repetitions=14, depth=1, in
>>> import pyllusion as ill
>>>
>>> ill.autostereogram(stimulus="3D", width=1000, height=500, font="arialbd.ttf") #doctest: +ELLIPSIS
<PIL.Image.Image ...>
<PIL.Image.Image ...> #doctest: +SKIP
>>> ill.autostereogram(stimulus="3D",
... pattern=ill.image_circles,
... n_repetitions=16,
... n=1000,
... invert=False,
... alpha=0.75,
... size_max=0.7) #doctest: +ELLIPSIS
<PIL.Image.Image ...>
... size_max=0.7) #doctest: +SKIP
"""
# If '/' and '.' in string, we assume it's a path
if "/" in stimulus and "." in stimulus:
Expand Down
Binary file removed pyllusion/image/ARIALN.TTF
Binary file not shown.
Binary file removed pyllusion/image/ARIALNB.TTF
Binary file not shown.
Binary file removed pyllusion/image/ARIALNBI.TTF
Binary file not shown.
Binary file removed pyllusion/image/ARIALNI.TTF
Binary file not shown.
Binary file removed pyllusion/image/arial.ttf
Binary file not shown.
Binary file removed pyllusion/image/arialbd.ttf
Binary file not shown.
Binary file removed pyllusion/image/arialbi.ttf
Binary file not shown.
Binary file removed pyllusion/image/ariali.ttf
Binary file not shown.
Binary file removed pyllusion/image/ariblk.ttf
Binary file not shown.
3 changes: 2 additions & 1 deletion pyllusion/image/image_blobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def _image_blob(x=450, y=100, width=800, height=600, sd=3):
>>> import pyllusion as ill
>>> import matplotlib.pyplot as plt
>>> array = _image_blob(sd=8)
>>> plt.imshow(array)
>>> plt.imshow(array) #doctest: +ELLIPSIS
<...>
"""

_x = height - x
Expand Down
12 changes: 5 additions & 7 deletions pyllusion/image/image_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ def image_text(text="Hello", width=500, height=500, x=0, y=0, size="auto", color
--------
>>> import pyllusion as ill
>>>
>>> image = ill.image_text(text="Hello", size=40)
>>> image = ill.image_text(image=image, size=30, y=0.5, text="I'm Red", color="red")
>>> image = ill.image_text(image=image, size=20, x=0.5, text="Bold and blurred", font="arialbd.ttf", blur=0.005)
>>> image #doctest: +ELLIPSIS
<PIL.Image.Image ...>
>>> ill.image_text(text="3D", width=1600, height=900, font="arial.ttf", blur=0.01) #doctest: +ELLIPSIS
<PIL.Image.Image ...>
>>> image = ill.image_text(text="Hello", size=40) #doctest: +SKIP
>>> image = ill.image_text(image=image, size=30, y=0.5, text="I'm Red", color="red") #doctest: +SKIP
>>> image = ill.image_text(image=image, size=20, x=0.5, text="Bold and blurred", font="arialbd.ttf", blur=0.005) #doctest: +SKIP
>>> image #doctest: +SKIP
>>> ill.image_text(text="3D", width=1600, height=900, font="arial.ttf", blur=0.01) #doctest: +SKIP
"""
# Get image
if image is None:
Expand Down
9 changes: 4 additions & 5 deletions pyllusion/image/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _coord_circle(image, diameter=0.1, x=0, y=0, unit="grid"):


def _coord_text(
image, text="hello", size="auto", x=0, y=0, font="./arial.ttf", unit="grid"
image, text="hello", size="auto", x=0, y=0, font="arial.ttf", unit="grid"
):
"""Get text coordinates
Expand All @@ -77,10 +77,9 @@ def _coord_text(
>>> image = PIL.Image.new('RGB', (500, 500), color = "white")
>>> draw = PIL.ImageDraw.Draw(image, 'RGB')
>>>
>>> coord, font = _coord_text(image, size="auto", x=-0.5, y=0.5)
>>> draw.text(coord, text="hello", fill="black", font=font)
>>> image #doctest: +ELLIPSIS
<PIL.Image.Image ...>
>>> coord, font = _coord_text(image, size="auto", x=-0.5, y=0.5) #doctest: +SKIP
>>> draw.text(coord, text="hello", fill="black", font=font) #doctest: +SKIP
>>> image #doctest: +SKIP
"""
if unit == "grid":
# Get coordinates in pixels
Expand Down
2 changes: 1 addition & 1 deletion pyllusion/movement/movement_circles.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ..image import image_circles


def movement_circles(n=50, duration=2, fps=30, **kwargs):
def movement_circles(n=50, duration=2, fps=30, width=500, height=500, **kwargs):
"""
>>> import pyllusion as ill
>>>
Expand Down

0 comments on commit 83513b2

Please sign in to comment.