Skip to content

Commit 29a3f7d

Browse files
committed
Update tests, remove template test
1 parent 0f0d64b commit 29a3f7d

File tree

3 files changed

+17
-149
lines changed

3 files changed

+17
-149
lines changed

folium/templates/fol_template.html

Lines changed: 0 additions & 72 deletions
This file was deleted.

tests/test_folium.py

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,8 @@ def test_init(self):
9696
assert self.m.get_name() == 'map_00000000000000000000000000000000'
9797
assert self.m.get_root() == self.m._parent
9898
assert self.m.location == [45.5236, -122.6750]
99-
assert self.m.zoom_start == 4
100-
assert self.m.max_lat == 90
101-
assert self.m.min_lat == -90
102-
assert self.m.max_lon == 180
103-
assert self.m.min_lon == -180
99+
assert self.m.options['zoom'] == 4
100+
assert self.m.options['maxBounds'] == [[-90, -180], [90, 180]]
104101
assert self.m.position == 'relative'
105102
assert self.m.height == (400, 'px')
106103
assert self.m.width == (900, 'px')
@@ -121,19 +118,6 @@ def test_init(self):
121118
}
122119
}
123120

124-
def test_cloudmade(self):
125-
"""Test cloudmade tiles and the API key."""
126-
with pytest.raises(ValueError):
127-
folium.Map(location=[45.5236, -122.6750], tiles='cloudmade')
128-
129-
m = folium.Map(location=[45.5236, -122.6750], tiles='cloudmade',
130-
API_key='###')
131-
cloudmade = 'http://{s}.tile.cloudmade.com/###/997/256/{z}/{x}/{y}.png'
132-
assert m._children['cloudmade'].tiles == cloudmade
133-
134-
bounds = m.get_bounds()
135-
assert bounds == [[None, None], [None, None]], bounds
136-
137121
def test_builtin_tile(self):
138122
"""Test custom maptiles."""
139123

@@ -201,47 +185,6 @@ def test_topo_json_smooth_factor(self):
201185
topojson_str = topo_json._template.module.script(topo_json)
202186
assert ''.join(topojson_str.split())[:-1] in ''.join(out.split())
203187

204-
def test_map_build(self):
205-
"""Test map build."""
206-
207-
# Standard map.
208-
self.setup()
209-
rendered = self.m._parent.render()
210-
211-
html_templ = self.env.get_template('fol_template.html')
212-
attr = 'http://openstreetmap.org'
213-
tile_layers = [
214-
{'id': 'tile_layer_'+'0'*32,
215-
'address': 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
216-
'attr': attr,
217-
'max_native_zoom': 20,
218-
'max_zoom': 20,
219-
'min_zoom': 0,
220-
'detect_retina': False,
221-
'no_wrap': False,
222-
'tms': False,
223-
'opacity': 1,
224-
'subdomains': 'abc'
225-
}]
226-
tmpl = {'map_id': 'map_' + '0' * 32,
227-
'lat': 45.5236, 'lon': -122.675,
228-
'width': 'width: 900.0px;',
229-
'height': 'height: 400.0px;',
230-
'zoom_level': 4,
231-
'max_bounds': True,
232-
'min_lat': -90,
233-
'max_lat': 90,
234-
'min_lon': -180,
235-
'max_lon': 180,
236-
'tile_layers': tile_layers,
237-
'crs': 'EPSG3857',
238-
'world_copy_jump': False,
239-
'zoom_control': True
240-
}
241-
expected = html_templ.render(tmpl, plugins={})
242-
243-
assert normalize(rendered) == normalize(expected)
244-
245188
def test_choropleth_features(self):
246189
"""Test to make sure that Choropleth function doesn't allow
247190
values outside of the domain defined by bins.

tests/test_raster_layers.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
-----------------
66
77
"""
8+
import pytest
89

910
import folium
1011
from folium.utilities import normalize
@@ -46,30 +47,26 @@ def _is_working_zoom_level(zoom, tiles, session):
4647

4748
def test_custom_tile_subdomains():
4849
"""Test custom tile subdomains."""
49-
5050
url = 'http://{s}.custom_tiles.org/{z}/{x}/{y}.png'
51-
m = folium.Map(location=[45.52, -122.67], tiles=url,
52-
attr='attribution',
53-
subdomains='1234')
54-
55-
url_with_name = 'http://{s}.custom_tiles-subdomains.org/{z}/{x}/{y}.png'
56-
tile_layer = folium.raster_layers.TileLayer(
51+
m = folium.Map()
52+
folium.TileLayer(
5753
tiles=url,
5854
name='subdomains2',
5955
attr='attribution',
60-
subdomains='5678'
61-
)
62-
tile_layer.add_to(m)
56+
subdomains='mytilesubdomain'
57+
).add_to(m)
58+
out = m._parent.render()
59+
assert 'mytilesubdomain' in out
6360

64-
m.add_tile_layer(
65-
tiles=url_with_name, attr='attribution',
66-
subdomains='9012'
67-
)
6861

69-
out = m._parent.render()
70-
assert '1234' in out
71-
assert '5678' in out
72-
assert '9012' in out
62+
def test_tilelayer_api_key():
63+
"""Test cloudmade tiles and the API key."""
64+
with pytest.raises(ValueError):
65+
folium.TileLayer(tiles='cloudmade')
66+
67+
tile_layer = folium.TileLayer(tiles='cloudmade', API_key='###')
68+
cloudmade = 'http://{s}.tile.cloudmade.com/###/997/256/{z}/{x}/{y}.png'
69+
assert tile_layer.tiles == cloudmade
7370

7471

7572
def test_wms():

0 commit comments

Comments
 (0)