From a9040d7d61a17ed502e39340ea3006bb2ca662e5 Mon Sep 17 00:00:00 2001 From: kamangir Date: Thu, 25 Jul 2024 18:27:53 -0700 Subject: [PATCH] =?UTF-8?q?almost=20expecting=20the=20tests=20to=20pass=20?= =?UTF-8?q?=F0=9F=A4=9E=F0=9F=8F=BD=20-=20kamangir/bolt#746?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blue_geo/__init__.py | 2 +- blue_geo/catalog/firms/area/__main__.py | 5 +-- ...rms_area.py => test_catalog_firms_area.py} | 43 +++++++++++-------- 3 files changed, 27 insertions(+), 23 deletions(-) rename blue_geo/tests/{test_datacube_firms_area.py => test_catalog_firms_area.py} (62%) diff --git a/blue_geo/__init__.py b/blue_geo/__init__.py index 61f78c3f..a8401e45 100644 --- a/blue_geo/__init__.py +++ b/blue_geo/__init__.py @@ -4,7 +4,7 @@ DESCRIPTION = f"{ICON} AI for precise geospatial data analysis and visualization." -VERSION = "4.143.1" +VERSION = "4.144.1" REPO_NAME = "blue-geo" diff --git a/blue_geo/catalog/firms/area/__main__.py b/blue_geo/catalog/firms/area/__main__.py index 3036b580..b4669498 100644 --- a/blue_geo/catalog/firms/area/__main__.py +++ b/blue_geo/catalog/firms/area/__main__.py @@ -2,9 +2,8 @@ from datetime import datetime, timedelta from blue_geo import VERSION from abcli.plugins.metadata import post_to_object -from blue_geo.catalog.firms.area import NAME -from blue_geo.catalog.firms.area.enums import Area, Source -from blue_geo.catalog.firms.area import FirmsAreaDatacube +from .enums import Area, Source +from . import FirmsAreaDatacube, NAME from blue_geo.logger import logger from blueness.argparse.generic import sys_exit diff --git a/blue_geo/tests/test_datacube_firms_area.py b/blue_geo/tests/test_catalog_firms_area.py similarity index 62% rename from blue_geo/tests/test_datacube_firms_area.py rename to blue_geo/tests/test_catalog_firms_area.py index 305b4932..e9caaf2c 100644 --- a/blue_geo/tests/test_datacube_firms_area.py +++ b/blue_geo/tests/test_catalog_firms_area.py @@ -2,6 +2,7 @@ import geopandas as gpd from abcli.modules.objects import unique_object from blue_geo.tests import assets +from blue_geo.catalog.firms import FirmsCatalog from blue_geo.catalog.firms.area import enums, FirmsAreaDatacube @@ -22,6 +23,10 @@ def test_datacube_from_query( datacube = FirmsAreaDatacube(area=area, source=source) + assert isinstance(datacube.catalog, FirmsCatalog) + + assert datacube.datacube_id + assert datacube.description assert datacube.ingest_url() @@ -32,44 +37,44 @@ def test_datacube_from_query( assert success assert isinstance(gdf, gpd.GeoDataFrame) - assert datacube.datacube_id - @pytest.mark.parametrize( ["datacube_id"], [ - ["datacube-firms_area-world-MODIS_NRT-2024-07-20-1"], + [ + [ + datacube_id + for datacube_id, datacube_class in assets.datacubes.items() + if datacube_class == FirmsAreaDatacube + ][-1] + ], ], ) -def test_datacube_from_datacube_id( - datacube_id: str, -): +def test_datacube_from_datacube_id(datacube_id: str): object_name = unique_object() - datacube = FirmsAreaDatacube(datacube_id=datacube_id) - - assert datacube.description + datacube = FirmsAreaDatacube(datacube_id) - assert datacube.ingest_url() + assert datacube.datacube_id - assert datacube.ingest_url(html=True) + assert datacube.description - success, gdf = datacube.ingest(object_name) + success, _ = datacube.ingest(object_name) assert success - assert isinstance(gdf, gpd.GeoDataFrame) - - assert datacube.datacube_id @pytest.mark.parametrize( ["datacube_id", "expected_success"], - assets.datacube_firms_area_parse_datacube_id, + [ + [ + [datacube_id, datacube_class == FirmsAreaDatacube] + for datacube_id, datacube_class in assets.datacubes.items() + ] + ], ) def test_parse_datacube_id( datacube_id: str, expected_success: bool, ): - success, segments = FirmsAreaDatacube.parse_datacube_id(datacube_id) + success, _ = FirmsAreaDatacube.parse_datacube_id(datacube_id) assert success == expected_success - if success: - assert segments