Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions python/grass/jupyter/tests/jupyter_utils_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Test Utils funcitons"""

import pytest

from grass.jupyter.utils import get_region, get_location_proj_string

IPython = pytest.importorskip("IPython", reason="IPython package not available")
ipywidgets = pytest.importorskip(
"ipywidgets", reason="ipywidgets package not available"
)


def test_get_region():
"""Test that get_region returns currnt computational region as dictionary."""
region = get_region()

Check failure on line 15 in python/grass/jupyter/tests/jupyter_utils_test.py

View workflow job for this annotation

GitHub Actions / pytest (ubuntu-24.04, 3.13)

test_get_region grass.tools.session_tools.ToolError: No active GRASS session: GISRC environment variable not set Run `g.region -p format=json` ended with an error (return code 1)

Check failure on line 15 in python/grass/jupyter/tests/jupyter_utils_test.py

View workflow job for this annotation

GitHub Actions / pytest (ubuntu-24.04, 3.10)

test_get_region grass.tools.session_tools.ToolError: No active GRASS session: GISRC environment variable not set Run `g.region -p format=json` ended with an error (return code 1)
assert isinstance(region, dict)
assert "north" in region
assert "south" in region
assert "east" in region
assert "west" in region


def test_get_location_proj_string():
"""Test that get_location_proj_string returns projection of environment in PROJ.4 format"""
projection = get_location_proj_string()

Check failure on line 25 in python/grass/jupyter/tests/jupyter_utils_test.py

View workflow job for this annotation

GitHub Actions / pytest (ubuntu-24.04, 3.13)

test_get_location_proj_string grass.tools.session_tools.ToolError: No active GRASS session: GISRC environment variable not set Run `g.proj -fp format=proj4` ended with an error (return code 1)

Check failure on line 25 in python/grass/jupyter/tests/jupyter_utils_test.py

View workflow job for this annotation

GitHub Actions / pytest (ubuntu-24.04, 3.10)

test_get_location_proj_string grass.tools.session_tools.ToolError: No active GRASS session: GISRC environment variable not set Run `g.proj -fp format=proj4` ended with an error (return code 1)
assert isinstance(projection, str)
assert projection != ""
assert "+proj=" in projection
Loading