Repository: RemDelaporteMathurin/h-transport-materials

Issue:
Users should be told when filtered group is None

Discussion:

Patch:
diff --git a/h_transport_materials/properties_group.py b/h_transport_materials/properties_group.py
index 2de20fb..9ecec3d 100644
--- a/h_transport_materials/properties_group.py
+++ b/h_transport_materials/properties_group.py
@@ -2,6 +2,7 @@ import numpy as np
 import json
 from pybtex.database import BibliographyData
 import pint
+import warnings
 
 from h_transport_materials.fitting import fit_arhenius
 from h_transport_materials import ureg, ArrheniusProperty
@@ -66,7 +67,8 @@ class PropertiesGroup(list):
             # append the property to the filtered list
             if (match and not exclude) or (not match and exclude):
                 filtered_props.append(prop)
-
+        if len(filtered_props) == 0:
+            warnings.warn("No property matching the requirements")
         return filtered_props
 
     def mean(self, samples_per_line=5, default_range=(300, 1200)):


Test patch:
diff --git a/tests/test_properties_group.py b/tests/test_properties_group.py
index 1d22ba2..f3092bc 100644
--- a/tests/test_properties_group.py
+++ b/tests/test_properties_group.py
@@ -160,3 +160,8 @@ def test_export_to_json():
                         assert f"{getattr(prop_ref, key):~}" == val
                     else:
                         assert getattr(prop_ref, key) == val
+
+
+def test_filter_warns_when_no_props():
+    with pytest.warns(UserWarning):
+        htm.diffusivities.filter(material="material_that_doesn_not_exist")