From 2a35ae8fbfb78a0783e000e900820c0733561a3f Mon Sep 17 00:00:00 2001 From: Melissa DeLucchi <113376043+delucchi-cmu@users.noreply.github.com> Date: Thu, 14 Mar 2024 11:48:08 -0400 Subject: [PATCH] Update plotting method testing. (#14) --- pyproject.toml | 1 + .../inspection/test_visualize_catalog_cloud.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b6c9271..065a452 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,7 @@ dev = [ "pylint", # Used for static linting of files "pytest", "pytest-cov", # Used to report total code coverage + "pytest-mock", # Used to mock objects in tests ] [build-system] diff --git a/tests/hipscat/inspection/test_visualize_catalog_cloud.py b/tests/hipscat/inspection/test_visualize_catalog_cloud.py index aeee397..cde7068 100644 --- a/tests/hipscat/inspection/test_visualize_catalog_cloud.py +++ b/tests/hipscat/inspection/test_visualize_catalog_cloud.py @@ -1,9 +1,18 @@ +import healpy as hp from hipscat.catalog import Catalog from hipscat.inspection import plot_pixels, plot_points +# pylint: disable=no-member -def test_generate_map_order1(small_sky_dir_cloud, example_cloud_storage_options): + +def test_generate_map_order1(small_sky_dir_cloud, example_cloud_storage_options, mocker): """Basic test that map data can be generated (does not test that a plot is rendered)""" cat = Catalog.read_from_hipscat(small_sky_dir_cloud, storage_options=example_cloud_storage_options) - plot_pixels(cat, draw_map=False) - plot_points(cat, draw_map=False) + + mocker.patch("healpy.mollview") + plot_pixels(cat) + hp.mollview.assert_called_once() + + hp.mollview.reset_mock() + plot_points(cat) + hp.mollview.assert_called_once()