Skip to content

Commit f1cc59e

Browse files
committed
Add test for png size
1 parent 2e2c00f commit f1cc59e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tests/test_repr.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,26 @@ def test__repr_png_no_image(m):
4848
assert png is None
4949

5050

51-
@pytest.mark.xfail
5251
def test__repr_png_is_bytes(m_png):
5352
png = m_png._repr_png_()
5453
assert isinstance(png, bytes)
5554

5655

57-
@pytest.mark.xfail
5856
@pytest.mark.skipif(sys.version_info < (3, 0),
5957
reason="Doesn't work on Python 2.7.")
6058
def test_valid_png(m_png):
6159
png = m_png._repr_png_()
6260
img = PIL.Image.open(io.BytesIO(png))
63-
isinstance(img, PIL.PngImagePlugin.PngImageFile)
61+
assert isinstance(img, PIL.PngImagePlugin.PngImageFile)
62+
63+
64+
@pytest.mark.skipif(sys.version_info < (3, 0),
65+
reason="Doesn't work on Python 2.7.")
66+
def test_valid_png_size(m_png):
67+
from folium.utilities import _parse_size
68+
w = h = 500
69+
m_png.width = _parse_size(w)
70+
m_png.height = _parse_size(h)
71+
png = m_png._repr_png_()
72+
img = PIL.Image.open(io.BytesIO(png))
73+
assert img.size == (w, h)

0 commit comments

Comments
 (0)