antares-devkit 0.12.0__tar.gz → 0.12.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/PKG-INFO +1 -1
  2. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/nuclear_transient/__init__.py +1 -0
  3. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/refitt_newsources_snrcut/__init__.py +1 -0
  4. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/models.py +10 -3
  5. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/utils.py +67 -1
  6. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/pyproject.toml +1 -1
  7. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/test/unit/antares_devkit/test_models.py +78 -0
  8. antares_devkit-0.12.1/test/unit/antares_devkit/test_utils.py +95 -0
  9. antares_devkit-0.12.1/test/unit/test_filters.py +39 -0
  10. antares_devkit-0.12.0/test/unit/test_filters.py +0 -17
  11. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/LICENSE.txt +0 -0
  12. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/README.md +0 -0
  13. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/__init__.py +0 -0
  14. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/bad_detection/__init__.py +0 -0
  15. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/bad_seeing/__init__.py +0 -0
  16. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/crash_filter/__init__.py +0 -0
  17. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/decam_shadow/__init__.py +0 -0
  18. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/desi_target/__init__.py +0 -0
  19. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/dwarf_nova_outburst/__init__.py +0 -0
  20. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/ecl_transient_1/__init__.py +0 -0
  21. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/ecl_transient_2/__init__.py +0 -0
  22. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/extragalactic/__init__.py +0 -0
  23. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/gw_em_candidates/__init__.py +0 -0
  24. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/highamp/__init__.py +0 -0
  25. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/highfluxchange/__init__.py +0 -0
  26. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/highsnr/__init__.py +0 -0
  27. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/if_anomaly_detection/__init__.py +0 -0
  28. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/if_anomaly_detection/data/__init__.py +0 -0
  29. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/if_anomaly_detection/data/paleo2_106IFmodel_472727objs_nest=1000_cont=0.001_transf.pkl +0 -0
  30. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/imbh/__init__.py +0 -0
  31. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/inm31/__init__.py +0 -0
  32. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/laiss_rfc_ad_filter/__init__.py +0 -0
  33. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/laiss_rfc_ad_filter/data/__init__.py +0 -0
  34. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/laiss_rfc_ad_filter/data/cls=binary_n_estimators=100_max_depth=35_rs=11_max_feats=35_cw=balanced.pkl +0 -0
  35. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/lantern/__init__.py +0 -0
  36. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/lantern/data/__init__.py +0 -0
  37. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/lantern/data/lantern_xgboost_t2.0.7.pkl +0 -0
  38. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/lsst_ddf/__init__.py +0 -0
  39. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/lsst_transient_quality_scimma/__init__.py +0 -0
  40. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/malanchev_anomaly_transient_dmdt/__init__.py +0 -0
  41. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/malanchev_anomaly_transient_dmdt/data/__init__.py +0 -0
  42. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/malanchev_anomaly_transient_dmdt/data/malanchev_ssiforest_v1.pickle +0 -0
  43. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/malanchev_features_v1/__init__.py +0 -0
  44. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/microlensing/__init__.py +0 -0
  45. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/novtest/__init__.py +0 -0
  46. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/nuttela_tao/__init__.py +0 -0
  47. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/passta_nearby_transients/__init__.py +0 -0
  48. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/persistent_dimmers/__init__.py +0 -0
  49. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/random_tagger_filter/__init__.py +0 -0
  50. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/recent_reddening/__init__.py +0 -0
  51. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/rubin_NovTest_soraisam/__init__.py +0 -0
  52. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/sample_filter/__init__.py +0 -0
  53. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/shadow_virgo/__init__.py +0 -0
  54. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/siena_mag_coord_cut/__init__.py +0 -0
  55. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/simple_slsn_filter/__init__.py +0 -0
  56. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/sso/__init__.py +0 -0
  57. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/sub_lum/__init__.py +0 -0
  58. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/superphot_plus_v1/__init__.py +0 -0
  59. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/superphot_plus_ztf_v3/__init__.py +0 -0
  60. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/test_dev_all/__init__.py +0 -0
  61. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/test_dev_lsst/__init__.py +0 -0
  62. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/test_dev_ztf/__init__.py +0 -0
  63. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/uniform_random_sample/__init__.py +0 -0
  64. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/vpdf/__init__.py +0 -0
  65. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/vpdf/data/__init__.py +0 -0
  66. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/vpdf/data/matheson_percent_grid_v1 +0 -0
  67. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/young_extragalactic_candidate/__init__.py +0 -0
  68. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/antares_devkit/filters/young_rubin_transients_soraisam/__init__.py +0 -0
  69. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/test/Dockerfile +0 -0
  70. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/test/__init__.py +0 -0
  71. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/test/conftest.py +0 -0
  72. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/test/data/large_locus.py +0 -0
  73. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/test/data/small_locus.py +0 -0
  74. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/test/unit/antares_devkit/filters/test_test_dev_all.py +0 -0
  75. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/test/unit/antares_devkit/filters/test_test_dev_lsst.py +0 -0
  76. {antares_devkit-0.12.0 → antares_devkit-0.12.1}/test/unit/antares_devkit/filters/test_test_dev_ztf.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: antares-devkit
3
- Version: 0.12.0
3
+ Version: 0.12.1
4
4
  Summary: Provides tools and utility methods to write and debug ANTARES filters with Python.
5
5
  Keywords: antares,devkit,filter development
6
6
  Author-Email: NSF NOIRLab ANTARES Team <antares@noirlab.edu>
@@ -9,6 +9,7 @@ class NuclearTransient(BaseFilter):
9
9
  # NAME = "Nuclear Transient"
10
10
  # [ANTARES] Original owner does not belong to the organization anymore
11
11
  SLACK_CHANNEL = "#filter-nuclear-transient"
12
+ TRIGGERING_SURVEY = "ztf"
12
13
  REQUIRED_LOCUS_PROPERTIES = [
13
14
  "ztf_object_id",
14
15
  ]
@@ -8,6 +8,7 @@ from antares_devkit.models import BaseFilter
8
8
  class refitt_newsources_snrcut(BaseFilter):
9
9
  # NAME = "refitt_newsources_snrcut"
10
10
  SLACK_CHANNEL = "#filter-refitt-newsources-snrcut"
11
+ TRIGGERING_SURVEY = "ztf"
11
12
  # REQUIRED_LOCUS_PROPERTIES = []
12
13
  REQUIRED_ALERT_PROPERTIES = [
13
14
  "ztf_sigmapsf",
@@ -720,17 +720,24 @@ class BaseFilter(abc.ABC):
720
720
  is_ztf_alert = alert.properties["ant_survey"] in SURVEYS["ztf"]
721
721
  is_lsst_alert = alert.properties["ant_survey"] in SURVEYS["lsst"]
722
722
  is_decat_alert = alert.properties["ant_survey"] in SURVEYS["decat"]
723
+ found_any = False
723
724
  for prop in self.REQUIRED_ALERT_PROPERTIES:
724
725
  # if the required prop is survey specific and it doesn't match the survey
725
726
  # for this alert then simply ignore that required prop.
726
727
  if not is_lsst_alert and prop.startswith(PROPERTY_PREFIX["lsst"]):
727
728
  continue
728
- elif not is_ztf_alert and prop.startswith(PROPERTY_PREFIX["ztf"]):
729
+ if not is_ztf_alert and prop.startswith(PROPERTY_PREFIX["ztf"]):
729
730
  continue
730
- elif not is_decat_alert and prop.startswith(PROPERTY_PREFIX["decat"]):
731
+ if not is_decat_alert and prop.startswith(PROPERTY_PREFIX["decat"]):
731
732
  continue
732
- elif prop not in alert.properties:
733
+ if prop not in alert.properties:
733
734
  return False
735
+ found_any = True
736
+
737
+ # Properies were required, but none were present on this alert.
738
+ if self.REQUIRED_ALERT_PROPERTIES and not found_any:
739
+ return False
740
+
734
741
  if max_level := self.REQUIRED_GRAV_WAVE_PROB_REGION:
735
742
  matches = [
736
743
  gw["contour_level"] <= max_level for gw in alert.grav_wave_events
@@ -4,7 +4,10 @@ import inspect
4
4
  import time
5
5
  from typing import Optional
6
6
 
7
- from antares_devkit.models import BaseFilter, DevKitLocus
7
+ from antares_devkit.models import BaseFilter, DevKitLocus, FilterProperty
8
+
9
+ REQUIRED_PROPERTY_FIELDS = {"name", "description", "type"}
10
+ VALID_PROPERTY_TYPES = {"int", "float", "str"}
8
11
 
9
12
 
10
13
  def get_filters_path():
@@ -197,3 +200,66 @@ def filter_report(filter_instance: BaseFilter, locus: DevKitLocus) -> dict:
197
200
  "new_locus_properties": new_locus_properties,
198
201
  "new_tags": new_tags,
199
202
  }
203
+
204
+
205
+ class FilterValidationError(ValueError):
206
+ """Exception class for filter validation errors."""
207
+
208
+
209
+ def validate_property_definition(property_definition: FilterProperty) -> None:
210
+ """Validate the fields of a single OUTPUT_LOCUS_PROPERTIES entry."""
211
+ if any(field not in property_definition for field in REQUIRED_PROPERTY_FIELDS):
212
+ missing_fields = {
213
+ field
214
+ for field in REQUIRED_PROPERTY_FIELDS
215
+ if field not in property_definition
216
+ }
217
+ raise FilterValidationError(f"Missing properties: {', '.join(missing_fields)}")
218
+
219
+ property_type = property_definition["type"]
220
+
221
+ if not isinstance(property_type, str):
222
+ raise FilterValidationError(
223
+ f"Expected str for filter type property, not {type(property_type)}"
224
+ )
225
+
226
+ if property_type not in VALID_PROPERTY_TYPES:
227
+ raise FilterValidationError(
228
+ f"{property_type} is not a valid filter type property. "
229
+ f"Expected one of {', '.join(VALID_PROPERTY_TYPES)}"
230
+ )
231
+
232
+ if not isinstance(property_definition["name"], str):
233
+ raise FilterValidationError(
234
+ (
235
+ f"Expected str for filter name property, not "
236
+ f"{type(property_definition['name'])}"
237
+ )
238
+ )
239
+
240
+ if not property_definition["name"].strip():
241
+ raise FilterValidationError(
242
+ "Must provide non-empty string for filter name property."
243
+ )
244
+
245
+ if not isinstance(property_definition["description"], str):
246
+ raise FilterValidationError(
247
+ (
248
+ f"Expected str for filter description property, not "
249
+ f"{type(property_definition['description'])}"
250
+ )
251
+ )
252
+
253
+ for field in REQUIRED_PROPERTY_FIELDS:
254
+ value = property_definition[field]
255
+
256
+ if value != value.strip():
257
+ raise FilterValidationError(
258
+ f"Leading and trailing whitespace forbidden in '{field!r}'. "
259
+ f"Got value: {value!r}"
260
+ )
261
+
262
+ if not property_definition["description"].strip():
263
+ raise FilterValidationError(
264
+ "Must provide non-empty filter description property."
265
+ )
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
6
6
 
7
7
  [project]
8
8
  name = "antares-devkit"
9
- version = "0.12.0"
9
+ version = "0.12.1"
10
10
  description = "Provides tools and utility methods to write and debug ANTARES filters with Python."
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.9"
@@ -118,6 +118,32 @@ class TestBaseFilter:
118
118
  def _run(self, locus):
119
119
  locus.tag("some_tag")
120
120
 
121
+ class ZtfFilterWithTriggeringAll(BaseFilter):
122
+ TRIGGERING_SURVEY = "all"
123
+
124
+ REQUIRED_ALERT_PROPERTIES = [
125
+ "ztf_sgscore1",
126
+ "ztf_distpsnr1",
127
+ "ztf_magpsf",
128
+ "ztf_magnr",
129
+ "ztf_distnr",
130
+ ]
131
+
132
+ def _run(self, locus):
133
+ locus.tag("some_tag")
134
+
135
+ class ZtfFilterWithDefaultTriggeringSurvey(BaseFilter):
136
+ REQUIRED_ALERT_PROPERTIES = [
137
+ "ztf_sgscore1",
138
+ "ztf_distpsnr1",
139
+ "ztf_magpsf",
140
+ "ztf_magnr",
141
+ "ztf_distnr",
142
+ ]
143
+
144
+ def _run(self, locus):
145
+ locus.tag("some_tag")
146
+
121
147
  def test_filter_skips_alert_from_different_survey(self):
122
148
  locus = DevKitLocus(
123
149
  id="locus-001",
@@ -195,3 +221,55 @@ class TestBaseFilter:
195
221
  )
196
222
  result = self.AllFilter().run(locus)
197
223
  assert result.status == "Succeeded"
224
+
225
+ def test_filter_skips_alert_when_no_properties_are_present(self):
226
+ locus = DevKitLocus(
227
+ id="locus-001",
228
+ ra=1.0,
229
+ dec=1.0,
230
+ alerts=[
231
+ {
232
+ "id": "alert-001",
233
+ "mjd": 11111.1,
234
+ "properties": {
235
+ "ant_survey": 4,
236
+ "ant_mjd": 1.0,
237
+ "ant_ra": 1.0,
238
+ "ant_dec": 1.0,
239
+ "ant_passband": "g",
240
+ "ant_mag": 1,
241
+ "ant_magerr": 0,
242
+ "ant_maglim": 2,
243
+ },
244
+ "grav_wave_events": [],
245
+ }
246
+ ],
247
+ )
248
+ result = self.ZtfFilterWithTriggeringAll().run(locus)
249
+ assert result.status == "Skipped"
250
+
251
+ def test_filter_with_default_survey_skips_alert_when_no_properties_are_present(self):
252
+ locus = DevKitLocus(
253
+ id="locus-001",
254
+ ra=1.0,
255
+ dec=1.0,
256
+ alerts=[
257
+ {
258
+ "id": "alert-001",
259
+ "mjd": 11111.1,
260
+ "properties": {
261
+ "ant_survey": 4,
262
+ "ant_mjd": 1.0,
263
+ "ant_ra": 1.0,
264
+ "ant_dec": 1.0,
265
+ "ant_passband": "g",
266
+ "ant_mag": 1,
267
+ "ant_magerr": 0,
268
+ "ant_maglim": 2,
269
+ },
270
+ "grav_wave_events": [],
271
+ }
272
+ ],
273
+ )
274
+ result = self.ZtfFilterWithDefaultTriggeringSurvey().run(locus)
275
+ assert result.status == "Skipped"
@@ -0,0 +1,95 @@
1
+ """Tests for util functions in the devkit."""
2
+
3
+ import string
4
+
5
+ import pytest
6
+
7
+ from antares_devkit.models import FilterProperty
8
+ from antares_devkit.utils import FilterValidationError, validate_property_definition
9
+
10
+ VALID_PROPERTY_DEFINITION: FilterProperty = {
11
+ "name": "test-author",
12
+ "type": "float",
13
+ "description": "A desription of the filter.",
14
+ }
15
+
16
+
17
+ def without(key: str) -> dict[str, object]:
18
+ if key not in VALID_PROPERTY_DEFINITION:
19
+ raise KeyError(
20
+ f"Key {key} not in property definition: "
21
+ f"expected one of {tuple(VALID_PROPERTY_DEFINITION.keys())}"
22
+ )
23
+
24
+ return {k: v for k, v in VALID_PROPERTY_DEFINITION.items() if k != key}
25
+
26
+
27
+ def with_(**kwargs: object) -> dict[str, object]:
28
+ if any(key not in VALID_PROPERTY_DEFINITION for key in kwargs):
29
+ missing_keys = {key for key in kwargs if key not in VALID_PROPERTY_DEFINITION}
30
+ raise KeyError(
31
+ f"Keys {tuple(missing_keys)} not in property definition: "
32
+ f"expected one of {tuple(VALID_PROPERTY_DEFINITION.keys())}. "
33
+ f"If you want to add a valid key, add it to VALID_PROPERTY_DEFINITION."
34
+ )
35
+
36
+ return {**VALID_PROPERTY_DEFINITION, **kwargs}
37
+
38
+
39
+ @pytest.mark.parametrize(
40
+ "property_definition, bad_field",
41
+ [
42
+ (without("description"), "description"),
43
+ (without("type"), "type"),
44
+ (without("name"), "name"),
45
+ (with_(name=""), "name"),
46
+ (with_(name=" "), "name"),
47
+ (with_(type="bad-type"), "type"),
48
+ (with_(description=""), "description"),
49
+ (with_(description=" "), "description"),
50
+ (with_(name=None), "name"),
51
+ (with_(description=None), "description"),
52
+ (with_(type=None), "type"),
53
+ ],
54
+ )
55
+ def test_invalid_property_definition_fails_validation(property_definition, bad_field):
56
+ """Parametrized test of various values expected to fail validation."""
57
+ with pytest.raises(FilterValidationError, match=bad_field):
58
+ validate_property_definition(property_definition)
59
+
60
+
61
+ def test_valid_property_definition_passes_validation():
62
+ """Test for the positive code path that a fully populated definition passes."""
63
+ validate_property_definition(VALID_PROPERTY_DEFINITION)
64
+
65
+
66
+ @pytest.mark.parametrize("field", list(VALID_PROPERTY_DEFINITION.keys()))
67
+ @pytest.mark.parametrize(
68
+ "template",
69
+ [
70
+ lambda whitespace, value: f"{whitespace}{value}",
71
+ lambda whitespace, value: f"{value}{whitespace}",
72
+ ],
73
+ ids=["leading", "trailing"],
74
+ )
75
+ @pytest.mark.parametrize("whitespace", string.whitespace + "\u00a0\u2003")
76
+ def test_surrounding_whitespace_is_invalid(field, template, whitespace):
77
+ new_field: str = template(whitespace, VALID_PROPERTY_DEFINITION[field])
78
+ new_property_definition = with_(**{field: new_field})
79
+
80
+ with pytest.raises(FilterValidationError):
81
+ validate_property_definition(new_property_definition)
82
+
83
+
84
+ @pytest.mark.parametrize(
85
+ "property_definition",
86
+ [
87
+ with_(name="author name"),
88
+ with_(name="a uthor name"),
89
+ with_(name="author nam e"),
90
+ ],
91
+ ids=lambda definition: repr(definition["name"]),
92
+ )
93
+ def test_whitespace_allowed_in_author_name(property_definition):
94
+ """Test that spaces are allowed in the author name."""
95
+ validate_property_definition(property_definition)
@@ -0,0 +1,39 @@
1
+ import itertools
2
+ from test.conftest import test_sample
3
+
4
+ import pytest
5
+
6
+ from antares_devkit.utils import (
7
+ FilterValidationError,
8
+ get_filter_instances,
9
+ get_filters,
10
+ validate_property_definition,
11
+ )
12
+
13
+
14
+ @pytest.mark.parametrize(
15
+ "data, c_filter",
16
+ itertools.product(
17
+ test_sample,
18
+ get_filter_instances(),
19
+ ),
20
+ )
21
+ def test_filter(memory_and_time_tracker, request, data, c_filter):
22
+ memory_and_time_tracker(c_filter, data)
23
+
24
+
25
+ @pytest.mark.parametrize(
26
+ "filter_class",
27
+ get_filters(select_all=True),
28
+ ids=lambda filter: filter.__name__,
29
+ )
30
+ def test_filter_class_output_locus_properties_are_valid(filter_class):
31
+ for property_definition in filter_class.OUTPUT_LOCUS_PROPERTIES:
32
+ try:
33
+ validate_property_definition(property_definition)
34
+
35
+ except FilterValidationError as err:
36
+ pytest.fail(
37
+ f"{filter_class.__name__}: property "
38
+ f"{property_definition.get('name')!r}: {err}"
39
+ )
@@ -1,17 +0,0 @@
1
- import itertools
2
- from test.conftest import test_sample
3
-
4
- import pytest
5
-
6
- from antares_devkit.utils import get_filter_instances
7
-
8
-
9
- @pytest.mark.parametrize(
10
- "data, c_filter",
11
- itertools.product(
12
- test_sample,
13
- get_filter_instances(),
14
- ),
15
- )
16
- def test_filter(memory_and_time_tracker, request, data, c_filter):
17
- memory_and_time_tracker(c_filter, data)