diff --git a/docs/usage.rst b/docs/usage.rst index 19bf374..3df331a 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -56,8 +56,6 @@ If you want to display the input raster data, the following code snippet demonst # Output: # Display the raster image in a matplotlib plot. -Adjust the size of the image - .. image:: raster_new.png :alt: An example raster image :align: center diff --git a/landusemix/utils.py b/landusemix/utils.py index 18b2902..a4a0851 100644 --- a/landusemix/utils.py +++ b/landusemix/utils.py @@ -107,7 +107,7 @@ def load_sample_shapefile(): Returns: geopandas.GeoDataFrame: The loaded sample GeoDataFrame. """ - sample_path = os.path.join(os.path.dirname(__file__), 'data', 'shapefiles', 'multiple', 'multiple.shp') + sample_path = os.path.join(os.path.dirname(__file__), 'data', 'shapefiles', 'multiple.shp') return load_shapefile(sample_path) diff --git a/tests/test_landusemix.py b/tests/test_landusemix.py index 882510d..77327d5 100644 --- a/tests/test_landusemix.py +++ b/tests/test_landusemix.py @@ -1,6 +1,7 @@ import unittest from landusemix import LandUseMixIndices import math +from landusemix.utils import * class TestLandUseMixIndices(unittest.TestCase): @@ -69,6 +70,18 @@ def test_herfindahl_hirschman_index_equal_area(self): self.assertAlmostEqual( indices.herfindahl_hirschman_index(), round(expected, 2)) + # Test Cases for loading data via utility functions + def test_load_sample_geojson(self): + self.assertIsNotNone(load_sample_geojson()) + + def test_load_sample_shapefile(self): + self.assertIsNotNone(load_sample_shapefile()) + + def test_load_sample_csv(self): + self.assertIsNotNone(load_sample_csv()) + + def test_load_sample_raster(self): + self.assertIsNotNone(load_sample_raster()) if __name__ == "__main__": unittest.main()