nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: CartoDB/cartoframes
Pull request #1173 (2019-11-07 10:30:58)

Add default bounds for map without layers
Fixes https://github.com/CartoDB/cartoframes/issues/975


Patch:
diff --git a/cartoframes/viz/map.py b/cartoframes/viz/map.py
index b7bf2176..4dbf90a7 100644
--- a/cartoframes/viz/map.py
+++ b/cartoframes/viz/map.py
@@ -451,10 +451,11 @@ def _conv2nan(val):
 
 
 def _compute_bounds(layers):
-    if layers is None or len(layers) == 0:
-        return None
+    init_bounds = None
+    if layers is not None and len(layers) > 0:
+        init_bounds = layers[0].bounds
 
-    bounds = _format_bounds(layers[0].bounds)
+    bounds = _format_bounds(init_bounds)
 
     for layer in layers[1:]:
         layer_bounds = _format_bounds(layer.bounds)
diff --git a/setup.py b/setup.py
index f8aa329c..9967405e 100644
--- a/setup.py
+++ b/setup.py
@@ -31,6 +31,7 @@ REQUIRES = [
     'carto>=1.8.1,<2.0',
     'jinja2>=2.10.1,<3.0',
     'geopandas>=0.6.0,<1.0',
+    'pyproj==2.2.2',
     'tqdm>=4.32.1,<5.0',
     'unidecode>=1.1.0,<2.0',
     'pyarrow>=0.14.1,<1.0',


Test patch:
diff --git a/tests/unit/viz/test_map.py b/tests/unit/viz/test_map.py
index 9ae31530..68ba4357 100644
--- a/tests/unit/viz/test_map.py
+++ b/tests/unit/viz/test_map.py
@@ -36,6 +36,7 @@ class TestMapInitialization(object):
         """Map should return a valid template"""
         map = Map()
         map._repr_html_()
+        assert map.bounds is not None
         assert map._html_map is not None
 
     def test_bounds(self):