Skip to content
Closed
Changes from 1 commit
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
30 changes: 30 additions & 0 deletions python/grass/jupyter/tests/utils_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Test Utils funcitons"""

from pathlib import Path

Check failure on line 3 in python/grass/jupyter/tests/utils_test.py

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-24.04)

Ruff (F401)

python/grass/jupyter/tests/utils_test.py:3:21: F401 `pathlib.Path` imported but unused

Comment thread
ayushjariyal marked this conversation as resolved.
Outdated
import pytest
from unittest.mock import patch

Check failure on line 6 in python/grass/jupyter/tests/utils_test.py

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-24.04)

Ruff (F401)

python/grass/jupyter/tests/utils_test.py:6:27: F401 `unittest.mock.patch` imported but unused
Comment thread
ayushjariyal marked this conversation as resolved.
Outdated

import grass.jupyter as gj

Check failure on line 8 in python/grass/jupyter/tests/utils_test.py

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-24.04)

Ruff (F401)

python/grass/jupyter/tests/utils_test.py:8:25: F401 `grass.jupyter` imported but unused
Comment thread
ayushjariyal marked this conversation as resolved.
Outdated
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():

Check failure on line 16 in python/grass/jupyter/tests/utils_test.py

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-24.04)

Ruff (E302)

python/grass/jupyter/tests/utils_test.py:16:1: E302 Expected 2 blank lines, found 1
"""Test that get_region returns currnt computational region as dictionary."""
region = get_region()
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():

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

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-24.04)

Ruff (E302)

python/grass/jupyter/tests/utils_test.py:25:1: E302 Expected 2 blank lines, found 1
"""Test that get_location_proj_string returns projection of environment in PROJ.4 format"""
projection = get_location_proj_string()
assert isinstance(projection, str)
assert projection != ""
assert "+proj=" in projection

Check failure on line 30 in python/grass/jupyter/tests/utils_test.py

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-24.04)

Ruff (W292)

python/grass/jupyter/tests/utils_test.py:30:34: W292 No newline at end of file
Comment thread
ayushjariyal marked this conversation as resolved.
Outdated
Loading