Skip to content

Commit f7840ee

Browse files
committed
fix tests for latest pytest
1 parent ad997a2 commit f7840ee

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

tests/test_repr.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,21 @@
1919

2020

2121
@pytest.fixture
22-
def make_map(png_enabled=False):
23-
m = folium.Map(png_enabled=png_enabled)
24-
return m
22+
def m():
23+
yield folium.Map(png_enabled=False)
2524

2625

27-
def test__repr_html_is_str():
28-
html = make_map()._repr_html_()
26+
@pytest.fixture
27+
def m_png():
28+
yield folium.Map(png_enabled=True)
29+
30+
def test__repr_html_is_str(m):
31+
html = m._repr_html_()
2932
assert isinstance(html, str)
3033

3134

32-
def test_valid_html():
33-
html = make_map()._repr_html_()
35+
def test_valid_html(m):
36+
html = m._repr_html_()
3437
parts = html.split('><')
3538
assert len(parts) == 6
3639
assert parts[0].lstrip('<div ') == 'style="width:100%;"'
@@ -41,19 +44,19 @@ def test_valid_html():
4144
assert parts[5] == '/div>'
4245

4346

44-
def test__repr_png_no_image():
45-
png = make_map(png_enabled=False)._repr_png_()
47+
def test__repr_png_no_image(m):
48+
png = m._repr_png_()
4649
assert png is None
4750

4851

49-
def test__repr_png_is_bytes():
50-
png = make_map(png_enabled=True)._repr_png_()
52+
def test__repr_png_is_bytes(m_png):
53+
png = m_png._repr_png_()
5154
assert isinstance(png, bytes)
5255

5356

5457
@pytest.mark.skipif(sys.version_info < (3, 0),
5558
reason="Doesn't work on Python 2.7.")
56-
def test_valid_png():
57-
png = make_map(png_enabled=True)._repr_png_()
59+
def test_valid_png(m_png):
60+
png = m_png._repr_png_()
5861
img = PIL.Image.open(io.BytesIO(png))
5962
isinstance(img, PIL.PngImagePlugin.PngImageFile)

0 commit comments

Comments
 (0)