Skip to content

Conversation

@Grufoony
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.07%. Comparing base (eb83c88) to head (aaef5f9).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #393      +/-   ##
==========================================
+ Coverage   84.76%   85.07%   +0.30%     
==========================================
  Files          53       53              
  Lines        5699     5763      +64     
  Branches      640      649       +9     
==========================================
+ Hits         4831     4903      +72     
+ Misses        857      849       -8     
  Partials       11       11              
Flag Coverage Δ
unittests 85.07% <ø> (+0.30%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Grufoony Grufoony force-pushed the updategetcartography branch from 1aba87d to bfbc552 Compare January 21, 2026 14:33
standardization of attributes.
"""

import folium

Check warning

Code scanning / Prospector (reported by Codacy)

Unable to import 'folium' (import-error) Warning

Unable to import 'folium' (import-error)
infer_speeds: bool = False,
return_type: str = "gdfs",
) -> tuple | nx.DiGraph:
) -> tuple[nx.DiGraph, gpd.GeoDataFrame, gpd.GeoDataFrame]:

Check warning

Code scanning / Prospector (reported by Codacy)

Value 'tuple' is unsubscriptable (unsubscriptable-object) Warning

Value 'tuple' is unsubscriptable (unsubscriptable-object)

import pytest
import networkx as nx
import folium

Check warning

Code scanning / Prospector (reported by Codacy)

Unable to import 'folium' (import-error) Warning test

Unable to import 'folium' (import-error)
result = to_folium_map(sample_graph, which="edges")
assert isinstance(result, folium.Map)
# Check that the map has children (the edges)
assert len(result._children) > 0

Check warning

Code scanning / Prospector (reported by Codacy)

Access to a protected member _children of a client class (protected-access) Warning test

Access to a protected member _children of a client class (protected-access)
"""Test visualization with nodes only."""
result = to_folium_map(sample_graph, which="nodes")
assert isinstance(result, folium.Map)
assert len(result._children) > 0

Check warning

Code scanning / Prospector (reported by Codacy)

Access to a protected member _children of a client class (protected-access) Warning test

Access to a protected member _children of a client class (protected-access)
nodes_only = to_folium_map(sample_graph, which="nodes")
# 'both' should have children from edges and nodes combined
# (minus the base tile layer which is common)
assert len(result._children) >= len(edges_only._children)

Check warning

Code scanning / Prospector (reported by Codacy)

Access to a protected member _children of a client class (protected-access) Warning test

Access to a protected member _children of a client class (protected-access)
# 'both' should have children from edges and nodes combined
# (minus the base tile layer which is common)
assert len(result._children) >= len(edges_only._children)
assert len(result._children) >= len(nodes_only._children)

Check warning

Code scanning / Prospector (reported by Codacy)

Access to a protected member _children of a client class (protected-access) Warning test

Access to a protected member _children of a client class (protected-access)
default_result = to_folium_map(sample_graph)
edges_result = to_folium_map(sample_graph, which="edges")
# Both should produce maps with the same number of children
assert len(default_result._children) == len(edges_result._children)

Check warning

Code scanning / Prospector (reported by Codacy)

Access to a protected member _children of a client class (protected-access) Warning test

Access to a protected member _children of a client class (protected-access)
assert -1 < location[0] < 1 # latitude
assert -1 < location[1] < 1 # longitude

def test_default_which_parameter(self, sample_graph):

Check warning

Code scanning / Pylint (reported by Codacy)

Method could be a function Warning test

Method could be a function
assert len(result._children) >= len(edges_only._children)
assert len(result._children) >= len(nodes_only._children)

def test_map_center_location(self, sample_graph):

Check warning

Code scanning / Pylint (reported by Codacy)

Method could be a function Warning test

Method could be a function
assert isinstance(result, folium.Map)
assert len(result._children) > 0

def test_both_edges_and_nodes(self, sample_graph):

Check warning

Code scanning / Pylint (reported by Codacy)

Method could be a function Warning test

Method could be a function
"""Test visualization with nodes only."""
result = to_folium_map(sample_graph, which="nodes")
assert isinstance(result, folium.Map)
assert len(result._children) > 0

Check warning

Code scanning / Pylint (reported by Codacy)

Do not use len(SEQUENCE) to determine if a sequence is empty Warning test

Do not use len(SEQUENCE) to determine if a sequence is empty
# Check that the map has children (the edges)
assert len(result._children) > 0

def test_nodes_only(self, sample_graph):

Check warning

Code scanning / Pylint (reported by Codacy)

Method could be a function Warning test

Method could be a function
result = to_folium_map(sample_graph, which="edges")
assert isinstance(result, folium.Map)
# Check that the map has children (the edges)
assert len(result._children) > 0

Check notice

Code scanning / Pylint (reported by Codacy)

Access to a protected member _children of a client class Note test

Access to a protected member _children of a client class
"""Test visualization with nodes only."""
result = to_folium_map(sample_graph, which="nodes")
assert isinstance(result, folium.Map)
assert len(result._children) > 0

Check notice

Code scanning / Pylint (reported by Codacy)

Access to a protected member _children of a client class Note test

Access to a protected member _children of a client class
nodes_only = to_folium_map(sample_graph, which="nodes")
# 'both' should have children from edges and nodes combined
# (minus the base tile layer which is common)
assert len(result._children) >= len(edges_only._children)

Check notice

Code scanning / Pylint (reported by Codacy)

Access to a protected member _children of a client class Note test

Access to a protected member _children of a client class
# 'both' should have children from edges and nodes combined
# (minus the base tile layer which is common)
assert len(result._children) >= len(edges_only._children)
assert len(result._children) >= len(nodes_only._children)

Check notice

Code scanning / Pylint (reported by Codacy)

Access to a protected member _children of a client class Note test

Access to a protected member _children of a client class
default_result = to_folium_map(sample_graph)
edges_result = to_folium_map(sample_graph, which="edges")
# Both should produce maps with the same number of children
assert len(default_result._children) == len(edges_result._children)

Check notice

Code scanning / Pylint (reported by Codacy)

Access to a protected member _children of a client class Note test

Access to a protected member _children of a client class
infer_speeds: bool = False,
return_type: str = "gdfs",
) -> tuple | nx.DiGraph:
) -> tuple[nx.DiGraph, gpd.GeoDataFrame, gpd.GeoDataFrame]:

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Value 'tuple' is unsubscriptable Warning

Value 'tuple' is unsubscriptable
return gdf_edges, gdf_nodes


def to_folium_map(

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Argument name "G" doesn't conform to snake_case naming style Warning

Argument name "G" doesn't conform to snake_case naming style
edges_cart, nodes_cart = get_cartography(
"Postua, Piedmont, Italy", return_type="gdfs"
)
G_CART, edges_cart, nodes_cart = get_cartography("Postua, Piedmont, Italy")

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Variable name "G_CART" doesn't conform to snake_case naming style Warning test

Variable name "G_CART" doesn't conform to snake_case naming style
"""Tests for to_folium_map function."""

@pytest.fixture
def sample_graph(self):

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Method could be a function Warning test

Method could be a function
edges, nodes = create_manhattan_cartography(n_x=3, n_y=3)
return graph_from_gdfs(edges, nodes)

def test_returns_folium_map(self, sample_graph):

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Method could be a function Warning test

Method could be a function
result = to_folium_map(sample_graph, which="edges")
assert isinstance(result, folium.Map)
# Check that the map has children (the edges)
assert len(result._children) > 0

Check notice

Code scanning / Pylintpython3 (reported by Codacy)

Access to a protected member _children of a client class Note test

Access to a protected member _children of a client class
"""Test visualization with nodes only."""
result = to_folium_map(sample_graph, which="nodes")
assert isinstance(result, folium.Map)
assert len(result._children) > 0

Check notice

Code scanning / Pylintpython3 (reported by Codacy)

Access to a protected member _children of a client class Note test

Access to a protected member _children of a client class
nodes_only = to_folium_map(sample_graph, which="nodes")
# 'both' should have children from edges and nodes combined
# (minus the base tile layer which is common)
assert len(result._children) >= len(edges_only._children)

Check notice

Code scanning / Pylintpython3 (reported by Codacy)

Access to a protected member _children of a client class Note test

Access to a protected member _children of a client class
# 'both' should have children from edges and nodes combined
# (minus the base tile layer which is common)
assert len(result._children) >= len(edges_only._children)
assert len(result._children) >= len(nodes_only._children)

Check notice

Code scanning / Pylintpython3 (reported by Codacy)

Access to a protected member _children of a client class Note test

Access to a protected member _children of a client class
default_result = to_folium_map(sample_graph)
edges_result = to_folium_map(sample_graph, which="edges")
# Both should produce maps with the same number of children
assert len(default_result._children) == len(edges_result._children)

Check notice

Code scanning / Pylintpython3 (reported by Codacy)

Access to a protected member _children of a client class Note test

Access to a protected member _children of a client class
def test_returns_folium_map(self, sample_graph):
"""Test that the function returns a folium.Map object."""
result = to_folium_map(sample_graph)
assert isinstance(result, folium.Map)

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
def test_edges_only(self, sample_graph):
"""Test visualization with edges only (default)."""
result = to_folium_map(sample_graph, which="edges")
assert isinstance(result, folium.Map)

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
result = to_folium_map(sample_graph, which="edges")
assert isinstance(result, folium.Map)
# Check that the map has children (the edges)
assert len(result._children) > 0

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
def test_nodes_only(self, sample_graph):
"""Test visualization with nodes only."""
result = to_folium_map(sample_graph, which="nodes")
assert isinstance(result, folium.Map)

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
"""Test visualization with nodes only."""
result = to_folium_map(sample_graph, which="nodes")
assert isinstance(result, folium.Map)
assert len(result._children) > 0

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
# The map should be centered around the mean of node coordinates
# For a Manhattan grid centered at (0, 0), the center should be near (0, 0)
location = result.location
assert location is not None

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
# For a Manhattan grid centered at (0, 0), the center should be near (0, 0)
location = result.location
assert location is not None
assert len(location) == 2

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert location is not None
assert len(location) == 2
# Check that location is reasonable (near 0,0 for default manhattan grid)
assert -1 < location[0] < 1 # latitude

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert len(location) == 2
# Check that location is reasonable (near 0,0 for default manhattan grid)
assert -1 < location[0] < 1 # latitude
assert -1 < location[1] < 1 # longitude

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
default_result = to_folium_map(sample_graph)
edges_result = to_folium_map(sample_graph, which="edges")
# Both should produce maps with the same number of children
assert len(default_result._children) == len(edges_result._children)

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
@Grufoony Grufoony merged commit bf4ee06 into main Jan 21, 2026
47 checks passed
@Grufoony Grufoony deleted the updategetcartography branch January 21, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants