Skip to content

Commit b410ab2

Browse files
authored
Fix uuid4 test failure with latest branca (#1556)
Fix tests in folium after merging python-visualization/branca#101 in branca
1 parent fc21516 commit b410ab2

1 file changed

Lines changed: 13 additions & 20 deletions

File tree

tests/test_folium.py

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121

2222
import pytest
2323

24-
try:
25-
from unittest import mock
26-
except ImportError:
27-
import mock
28-
2924

3025
rootpath = os.path.abspath(os.path.dirname(__file__))
3126

@@ -74,24 +69,22 @@ class TestFolium(object):
7469

7570
def setup(self):
7671
"""Setup Folium Map."""
77-
with mock.patch('branca.element.uuid4') as uuid4:
78-
uuid4().hex = '0' * 32
79-
attr = 'http://openstreetmap.org'
80-
self.m = folium.Map(
81-
location=[45.5236, -122.6750],
82-
width=900,
83-
height=400,
84-
max_zoom=20,
85-
zoom_start=4,
86-
max_bounds=True,
87-
attr=attr
88-
)
72+
attr = 'http://openstreetmap.org'
73+
self.m = folium.Map(
74+
location=[45.5236, -122.6750],
75+
width=900,
76+
height=400,
77+
max_zoom=20,
78+
zoom_start=4,
79+
max_bounds=True,
80+
attr=attr
81+
)
8982
self.env = Environment(loader=PackageLoader('folium', 'templates'))
9083

9184
def test_init(self):
9285
"""Test map initialization."""
9386

94-
assert self.m.get_name() == 'map_00000000000000000000000000000000'
87+
assert self.m.get_name().startswith('map_')
9588
assert self.m.get_root() == self.m._parent
9689
assert self.m.location == [45.5236, -122.6750]
9790
assert self.m.options['zoom'] == 4
@@ -105,11 +98,11 @@ def test_init(self):
10598
assert self.m.global_switches.disable_3d is False
10699
assert self.m.to_dict() == {
107100
'name': 'Map',
108-
'id': '00000000000000000000000000000000',
101+
'id': self.m._id,
109102
'children': {
110103
'openstreetmap': {
111104
'name': 'TileLayer',
112-
'id': '00000000000000000000000000000000',
105+
'id': self.m._children["openstreetmap"]._id,
113106
'children': {}
114107
}
115108
}

0 commit comments

Comments
 (0)