From 75a72250061414eef589b01006ee1f0afb9d53b9 Mon Sep 17 00:00:00 2001 From: shhaaluu Date: Thu, 21 Dec 2023 13:58:45 +0530 Subject: [PATCH] NAK-742 Updated testcases for semantic validation --- .../testfile_invalid_low_assign.json | 142 ++++ .../testfile_invalid_low_configure.json | 122 ++++ .../testfile_invalid_mid_assign.json | 160 +++++ .../testfile_invalid_mid_configure.json | 117 ++++ .../test_files/testfile_valid_low_assign.json | 117 ++++ .../testfile_valid_low_configure.json | 79 +++ .../test_files/testfile_valid_mid_assign.json | 136 ++++ .../testfile_valid_mid_configure.json | 224 +++++++ .../telvalidation/test_semantic_validator.py | 622 +++--------------- 9 files changed, 1194 insertions(+), 525 deletions(-) create mode 100644 tests/telvalidation/test_files/testfile_invalid_low_assign.json create mode 100644 tests/telvalidation/test_files/testfile_invalid_low_configure.json create mode 100644 tests/telvalidation/test_files/testfile_invalid_mid_assign.json create mode 100644 tests/telvalidation/test_files/testfile_invalid_mid_configure.json create mode 100644 tests/telvalidation/test_files/testfile_valid_low_assign.json create mode 100644 tests/telvalidation/test_files/testfile_valid_low_configure.json create mode 100644 tests/telvalidation/test_files/testfile_valid_mid_assign.json create mode 100644 tests/telvalidation/test_files/testfile_valid_mid_configure.json diff --git a/tests/telvalidation/test_files/testfile_invalid_low_assign.json b/tests/telvalidation/test_files/testfile_invalid_low_assign.json new file mode 100644 index 00000000..240c1952 --- /dev/null +++ b/tests/telvalidation/test_files/testfile_invalid_low_assign.json @@ -0,0 +1,142 @@ +{ + "interface": "https://schema.skao.int/ska-low-tmc-assignresources/3.2", + "transaction_id": "txn-....-00001", + "subarray_id": 1, + "mccs": { + "subarray_beam_ids": [4], + "station_ids": [[1, 2]], + "channel_blocks": [3] + }, + "sdp": { + "interface": "https://schema.skao.int/ska-sdp-assignres/0.4", + "resources": { + "receptors": [ + "SKA001", + "SKA002", + "SKA003", + "SKA004" + ] + }, + "execution_block": { + "eb_id": "eb-test-20220916-00000", + "context": {}, + "max_length": 3600.0, + "beams": [{ + "beam_id": "vis0", + "function": "pulsar timing" + }, + { + "beam_id": "pss1", + "search_beam_id": 1, + "function": "pulsar search" + }], + "scan_types": [ + { + "scan_type_id": ".default", + "beams": { + "vis0": { + "channels_id": "vis_channels", + "polarisations_id": "all" + } + } + }, + { + "scan_type_id": "target:a", + "derive_from": ".default", + "beams": { + "vis0": { + "field_id": "field_a" + } + } + }, + { + "scan_type_id": "calibration:b", + "derive_from": ".default", + "beams": { + "vis0": { + "field_id": "field_b" + } + } + } + ], + "channels": [ + { + "channels_id": "vis_channels", + "spectral_windows": [{ + "spectral_window_id": "fsp_1_channels", + "count": 744, + "start": 0, + "stride": 2, + "freq_min": 35000000.0, + "freq_max": 49880000000000.0, + "link_map": [[0, 0], [200, 1], [744, 2], [944, 3]] + }, + { + "spectral_window_id": "fsp_2_channels", + "count": 744, + "start": 2000, + "stride": 1, + "freq_min": 36000000.0, + "freq_max": 49880000000000.0, + "link_map": [[2000, 4], [2200, 5]] + }] + } + ], + "polarisations": [ + { + "polarisations_id": "all", + "corr_type": [ + "XX", + "XY", + "YX", + "YY" + ] + } + ], + "fields": [ + { + "field_id": "field_a", + "phase_dir": { + "ra": [ + 123.0 + ], + "dec": [ + -60.0 + ], + "reference_time": "...", + "reference_frame": "ICRF3" + }, + "pointing_fqdn": "..." + }, + { + "field_id": "field_b", + "phase_dir": { + "ra": [ + 123.0 + ], + "dec": [ + -60.0 + ], + "reference_time": "...", + "reference_frame": "ICRF3" + }, + "pointing_fqdn": "..." + } + ] + }, + "processing_blocks": [ + { + "pb_id": "pb-test-20220916-00000", + "script": { + "kind": "realtime", + "name": "test-receive-addresses", + "version": "0.5.0" + }, + "sbi_ids": [ + "sbi-test-20220916-00000" + ], + "parameters": {} + } + ] + } + } \ No newline at end of file diff --git a/tests/telvalidation/test_files/testfile_invalid_low_configure.json b/tests/telvalidation/test_files/testfile_invalid_low_configure.json new file mode 100644 index 00000000..b9d8543b --- /dev/null +++ b/tests/telvalidation/test_files/testfile_invalid_low_configure.json @@ -0,0 +1,122 @@ +{ + "interface": "https://schema.skao.int/ska-low-tmc-configure/3.1", + "transaction_id": "txn-....-00001", + "mccs": { + "stations": [ + { + "station_id": 1 + }, + { + "station_id": 2 + } + ], + "subarray_beams": [ + { + "subarray_beam_id": 1, + "station_ids": [1, 2], + "update_rate": 0.0, + "channels": [ + [0, 8, 1, 1], + [8, 8, 2, 1], + [24, 16, 2, 1] + ], + "antenna_weights": [1.0, 1.0, 1.0], + "phase_centre": [0.0, 0.0], + "target": { + "reference_frame": "HORIZON", + "target_name": "DriftScan", + "az": 180.0, + "el": 45.0 + } + } + ] + }, + "sdp": { + "interface": "https://schema.skao.int/ska-sdp-configure/0.4", + "scan_type": "science_A" + }, + "csp": { + "interface": "https://schema.skao.int/ska-low-csp-configure/0.0", + "common": { + "config_id": "sbi-mvp01-20200325-00001-science_A" + }, + "lowcbf": { + "stations": { + "stns": [ + [ + 1, + 1 + ], + [ + 2, + 1 + ], + [ + 3, + 1 + ], + [ + 4, + 1 + ], + [ + 5, + 1 + ], + [ + 6, + 1 + ], + [ + 7, + 1 + ] + ], + "stn_beams": [ + { + "stn_beam_id": 1, + "freq_ids": [ + 400 + ] + } + ] + }, + "vis": { + "fsp": { + "function_mode": "pulsar_search", + "fsp_ids": [ + 1, 2, 3, 3, 5, 6, 7 + ] + }, + "stn_beams": [ + { + "stn_beam_id": 1, + "host": [ + [ + 0, + "192.168.1.00" + ] + ], + "port": [ + [ + 0, + 9000, + 1 + ] + ], + "mac": [ + [ + 0, + "02-03-04-0a-0b-0c" + ] + ], + "integration_ms": 849 + } + ] + } + } + }, + "tmc": { + "scan_duration": 10.0 + } + } \ No newline at end of file diff --git a/tests/telvalidation/test_files/testfile_invalid_mid_assign.json b/tests/telvalidation/test_files/testfile_invalid_mid_assign.json new file mode 100644 index 00000000..1f7d9cd6 --- /dev/null +++ b/tests/telvalidation/test_files/testfile_invalid_mid_assign.json @@ -0,0 +1,160 @@ +{ + "interface": "https://schema.skao.int/ska-tmc-assignresources/2.1", + "subarray_id": 1, + "dish": { + "receptor_ids": [ + "SKA001", + "SKA002", + "SKA003", + "SKA004", + "SKA005", + "SKA006" + ] + }, + "sdp": { + "interface": "https://schema.skao.int/ska-sdp-assignres/0.4", + "execution_block": { + "eb_id": "eb-test-20220916-00000", + "max_length": 100.0, + "context": {}, + "beams": [{ + "beam_id": "vis0", + "function": "pulsar timing" + }, { + "beam_id": "pss1", + "search_beam_id": 1, + "function": "pulsar search" + }], + "scan_types": [{ + "scan_type_id": ".default", + "beams": { + "vis0": { + "channels_id": "vis_channels", + "polarisations_id": "all" + }, + "pss1": { + "field_id": "field_a", + "channels_id": "pulsar_channels", + "polarisations_id": "all" + } + } + }, { + "scan_type_id": "target:a", + "derive_from": ".default", + "beams": { + "vis0": { + "field_id": "field_a" + } + } + }], + "channels": [{ + "channels_id": "vis_channels", + "spectral_windows": [{ + "spectral_window_id": "fsp_1_channels", + "count": 744, + "start": 0, + "stride": 2, + "freq_min": 50000000000000.0, + "freq_max": 49880000000000.0, + "link_map": [[0, 0], [200, 1], [744, 2], [944, 3]] + }, { + "spectral_window_id": "fsp_2_channels", + "count": 744, + "start": 2000, + "stride": 1, + "freq_min": 36000000.0, + "freq_max": 49880000000000.0, + "link_map": [[2000, 4], [2200, 5]] + }] + }, { + "channels_id": "pulsar_channels", + "spectral_windows": [{ + "spectral_window_id": "pulsar_fsp_channels", + "count": 744, + "start": 0, + "freq_min": 35000000.0, + "freq_max": 3680049880000000000.0 + }] + }], + "polarisations": [{ + "polarisations_id": "all", + "corr_type": ["XX", "XY", "YY", "YX"] + }], + "fields": [{ + "field_id": "field_a", + "phase_dir": { + "ra": [123, 0.1], + "dec": [80, 0.1], + "reference_time": "2023-02-16T01:23:45.678900", + "reference_frame": "ICRF3" + }, + "pointing_fqdn": "low-tmc/telstate/0/pointing" + }] + }, + "processing_blocks": [ + { + "pb_id": "pb-mvp01-20200325-00001", + "script": { + "kind": "realtime", + "name": "vis_receive", + "version": "0.1.0" + }, + "parameters": { + } + }, + { + "pb_id": "pb-mvp01-20200325-00002", + "script": { + "kind": "realtime", + "name": "test_realtime", + "version": "0.1.0" + }, + "parameters": { + } + }, + { + "pb_id": "pb-mvp01-20200325-00003", + "script": { + "kind": "batch", + "name": "ical", + "version": "0.1.0" + }, + "parameters": { + }, + "dependencies": [ + { + "pb_id": "pb-mvp01-20200325-00001", + "kind": [ + "visibilities" + ] + } + ], + "sbi_ids": ["sbi-mvp01-20200325-00001"] + }, + { + "pb_id": "pb-mvp01-20200325-00004", + "script": { + "kind": "batch", + "name": "dpreb", + "version": "0.1.0" + }, + "parameters": { + }, + "dependencies": [ + { + "pb_id": "pb-mvp01-20200325-00003", + "kind": [ + "calibration" + ] + } + ] + } + ], + "resources": { + "csp_links": [1, 2, 3, 4], + "receptors": ["FS4", "FS8", "FS16", "FS17", "FS22"], + "receive_nodes": 10 + } + } + } + \ No newline at end of file diff --git a/tests/telvalidation/test_files/testfile_invalid_mid_configure.json b/tests/telvalidation/test_files/testfile_invalid_mid_configure.json new file mode 100644 index 00000000..7417fde2 --- /dev/null +++ b/tests/telvalidation/test_files/testfile_invalid_mid_configure.json @@ -0,0 +1,117 @@ +{ + "interface": "https://schema.skao.int/ska-tmc-configure/2.1", + "pointing": { + "target": { + "reference_frame": "ICRS", + "target_name": "Polaris Australis", + "ra": "21:08:47.92", + "dec": "-88:57:22.9" + } + }, + "dish": { + "receiver_band": "5c" + }, + "csp": { + "interface": "https://schema.skao.int/ska-csp-configure/2.0", + "subarray": { + "subarray_name": "science period 23" + }, + "common": { + "config_id": "sbi-mvp01-20200325-00001-science_A", + "frequency_band": "1", + "subarray_id": 1, + "band_5_tuning": [5.85, 7.25] + }, + "cbf": { + "fsp": [ + { + "fsp_id": 6, + "function_mode": "VLBI", + "frequency_slice_id": 1, + "integration_factor": 1, + "zoom_factor": 1, + "channel_averaging_map": [ + [ + 0, + 2 + ], + [ + 744, + 0 + ] + ], + "channel_offset": 0, + "output_link_map": [ + [ + 0, + 0 + ], + [ + 200, + 1 + ] + ] + }, + { + "fsp_id": 9, + "function_mode": "VLBI", + "frequency_slice_id": 3, + "integration_factor": 1, + "zoom_factor": 1, + "channel_averaging_map": [ + [ + 0, + 2 + ], + [ + 744, + 0 + ] + ], + "channel_offset": 744, + "output_link_map": [ + [ + 0, + 4 + ], + [ + 200, + 5 + ] + ], + "zoom_window_tuning": 4700000 + }, + { + "fsp_id": 8, + "function_mode": "VLBI", + "frequency_slice_id": 3, + "integration_factor": 1, + "zoom_factor": 1 + }, + { + "fsp_id": 7, + "function_mode": "VLBI", + "frequency_slice_id": 3, + "integration_factor": 1, + "zoom_factor": 1 + }, + { + "fsp_id": 5, + "function_mode": "VLBI", + "frequency_slice_id": 3, + "integration_factor": 1, + "zoom_factor": 1 + } + ] + } + }, + + "sdp": { + "interface": "https://schema.skao.int/ska-sdp-configure/0.4", + "scan_type": "science_A" + }, + "tmc": { + "scan_duration": 10.0 + } + } + \ No newline at end of file diff --git a/tests/telvalidation/test_files/testfile_valid_low_assign.json b/tests/telvalidation/test_files/testfile_valid_low_assign.json new file mode 100644 index 00000000..c05e8a2e --- /dev/null +++ b/tests/telvalidation/test_files/testfile_valid_low_assign.json @@ -0,0 +1,117 @@ +{ + "interface": "https://schema.skao.int/ska-low-tmc-assignresources/3.2", + "subarray_id": 1, + "mccs": { + "subarray_beam_ids": [4], + "station_ids": [[1, 2]], + "channel_blocks": [3] + }, + "sdp": { + "interface": "https://schema.skao.int/ska-sdp-assignres/0.4", + "resources": { + "receptors": ["SKA001", "SKA002", "SKA003", "SKA004"] + }, + "execution_block": { + "eb_id": "eb-test-20220916-00000", + "context": {}, + "max_length": 3600.0, + "beams": [ + { + "beam_id": "vis0", + "function": "visibilities" + } + ], + "scan_types": [ + { + "scan_type_id": ".default", + "beams": { + "vis0": { + "channels_id": "vis_channels", + "polarisations_id": "all" + } + } + }, + { + "scan_type_id": "target:a", + "derive_from": ".default", + "beams": { + "vis0": { + "field_id": "field_a" + } + } + }, + { + "scan_type_id": "calibration:b", + "derive_from": ".default", + "beams": { + "vis0": { + "field_id": "field_b" + } + } + } + ], + "channels": [ + { + "channels_id": "vis_channels", + "spectral_windows": [ + { + "spectral_window_id": "fsp_1_channels", + "count": 4, + "start": 0, + "stride": 2, + "freq_min": 350000000.0, + "freq_max": 368000000.0, + "link_map": [ + [0, 0], + [200, 1], + [744, 2], + [944, 3] + ] + } + ] + } + ], + "polarisations": [ + { + "polarisations_id": "all", + "corr_type": ["XX", "XY", "YX", "YY"] + } + ], + "fields": [ + { + "field_id": "field_a", + "phase_dir": { + "ra": [123.0], + "dec": [-60.0], + "reference_time": "...", + "reference_frame": "ICRF3" + }, + "pointing_fqdn": "..." + }, + { + "field_id": "field_b", + "phase_dir": { + "ra": [123.0], + "dec": [-60.0], + "reference_time": "...", + "reference_frame": "ICRF3" + }, + "pointing_fqdn": "..." + } + ] + }, + "processing_blocks": [ + { + "pb_id": "pb-test-20220916-00000", + "script": { + "kind": "realtime", + "name": "test-receive-addresses", + "version": "0.5.0" + }, + "sbi_ids": ["sbi-test-20220916-00000"], + "parameters": {} + } + ] + } + } + \ No newline at end of file diff --git a/tests/telvalidation/test_files/testfile_valid_low_configure.json b/tests/telvalidation/test_files/testfile_valid_low_configure.json new file mode 100644 index 00000000..6e5103e1 --- /dev/null +++ b/tests/telvalidation/test_files/testfile_valid_low_configure.json @@ -0,0 +1,79 @@ +{ + "interface": "https://schema.skao.int/ska-low-tmc-configure/3.1", + "mccs": { + "stations": [ + { + "station_id": 1 + }, + { + "station_id": 2 + } + ], + "subarray_beams": [ + { + "subarray_beam_id": 1, + "station_ids": [1, 2], + "update_rate": 0.0, + "channels": [ + [0, 8, 1, 1], + [8, 8, 2, 1], + [24, 16, 2, 1] + ], + "antenna_weights": [1.0, 1.0, 1.0], + "phase_centre": [0.0, 0.0], + "target": { + "reference_frame": "HORIZON", + "target_name": "DriftScan", + "az": 180.0, + "el": 45.0 + } + } + ] + }, + "sdp": { + "interface": "https://schema.skao.int/ska-sdp-configure/0.4", + "scan_type": "science_A" + }, + "csp": { + "interface": "https://schema.skao.int/ska-low-csp-configure/0.0", + "common": { + "config_id": "sbi-mvp01-20200325-00001-science_A" + }, + "lowcbf": { + "stations": { + "stns": [ + [1, 1], + [2, 1], + [3, 1], + [4, 1], + [5, 1], + [6, 1] + ], + "stn_beams": [ + { + "stn_beam_id": 1, + "freq_ids": [400] + } + ] + }, + "vis": { + "fsp": { + "function_mode": "vis", + "fsp_ids": [1, 2, 3, 4, 5, 6] + }, + "stn_beams": [ + { + "stn_beam_id": 1, + "host": [[0, "192.168.1.00"]], + "port": [[0, 9000, 1]], + "mac": [[0, "02-03-04-0a-0b-0c"]], + "integration_ms": 849 + } + ] + } + } + }, + "tmc": { + "scan_duration": 10.0 + } + } \ No newline at end of file diff --git a/tests/telvalidation/test_files/testfile_valid_mid_assign.json b/tests/telvalidation/test_files/testfile_valid_mid_assign.json new file mode 100644 index 00000000..3474a43d --- /dev/null +++ b/tests/telvalidation/test_files/testfile_valid_mid_assign.json @@ -0,0 +1,136 @@ +{ + "interface": "https://schema.skao.int/ska-tmc-assignresources/2.1", + "subarray_id": 1, + "dish": { + "receptor_ids": [ + "SKA001", + "SKA002" + ] + }, + "sdp": { + "interface": "https://schema.skao.int/ska-sdp-assignres/0.4", + "execution_block": { + "eb_id": "eb-test-20220916-00000", + "max_length": 100.0, + "context": {}, + "beams": [{ + "beam_id": "vis0", + "function": "visibilities" + }], + "scan_types": [{ + "scan_type_id": ".default", + "beams": { + "vis0": { + "channels_id": "vis_channels", + "polarisations_id": "all" + }, + "pss1": { + "field_id": "field_a", + "channels_id": "pulsar_channels", + "polarisations_id": "all" + } + } + }, { + "scan_type_id": "target:a", + "derive_from": ".default", + "beams": { + "vis0": { + "field_id": "field_a" + } + } + }], + "channels": [{ + "channels_id": "vis_channels", + "spectral_windows": [{ + "spectral_window_id": "fsp_1_channels", + "count": 14880, + "start": 0, + "stride": 2, + "freq_min": 350000000.0, + "freq_max": 368000000.0, + "link_map": [[0, 0], [200, 1], [744, 2], [944, 3]] + }] + }], + "polarisations": [{ + "polarisations_id": "all", + "corr_type": ["XX", "XY", "YY", "YX"] + }], + "fields": [{ + "field_id": "field_a", + "phase_dir": { + "ra": [123, 0.1], + "dec": [80, 0.1], + "reference_time": "2023-02-16T01:23:45.678900", + "reference_frame": "ICRF3" + }, + "pointing_fqdn": "low-tmc/telstate/0/pointing" + }] + }, + "processing_blocks": [ + { + "pb_id": "pb-mvp01-20200325-00001", + "script": { + "kind": "realtime", + "name": "vis_receive", + "version": "0.1.0" + }, + "parameters": { + } + }, + { + "pb_id": "pb-mvp01-20200325-00002", + "script": { + "kind": "realtime", + "name": "test_realtime", + "version": "0.1.0" + }, + "parameters": { + } + }, + { + "pb_id": "pb-mvp01-20200325-00003", + "script": { + "kind": "batch", + "name": "ical", + "version": "0.1.0" + }, + "parameters": { + }, + "dependencies": [ + { + "pb_id": "pb-mvp01-20200325-00001", + "kind": [ + "visibilities" + ] + } + ], + "sbi_ids": ["sbi-mvp01-20200325-00001"] + }, + { + "pb_id": "pb-mvp01-20200325-00004", + "script": { + "kind": "batch", + "name": "dpreb", + "version": "0.1.0" + }, + "parameters": { + }, + "dependencies": [ + { + "pb_id": "pb-mvp01-20200325-00003", + "kind": [ + "calibration" + ] + } + ] + } + ], + "resources": { + "csp_links": [1, 2, 3, 4], + "receptors": [ + "SKA001", + "SKA002" + ] + } + } +} diff --git a/tests/telvalidation/test_files/testfile_valid_mid_configure.json b/tests/telvalidation/test_files/testfile_valid_mid_configure.json new file mode 100644 index 00000000..dc8dcff0 --- /dev/null +++ b/tests/telvalidation/test_files/testfile_valid_mid_configure.json @@ -0,0 +1,224 @@ +{ + "interface": "https://schema.skao.int/ska-tmc-configure/2.1", + "pointing": { + "target": { + "reference_frame": "ICRS", + "target_name": "Polaris Australis", + "ra": "21:08:47.92", + "dec": "-88:57:22.9" + } + }, + "dish": { + "receiver_band": "1" + }, + "csp": { + "interface": "https://schema.skao.int/ska-csp-configure/2.0", + "subarray": { + "subarray_name": "science period 23" + }, + "common": { + "config_id": "sbi-mvp01-20200325-00001-science_A", + "frequency_band": "1", + "subarray_id": 1, + "band_5_tuning": [5.85, 7.25] + }, + "cbf": { + "fsp": [ + { + "fsp_id": 1, + "function_mode": "CORR", + "frequency_slice_id": 1, + "integration_factor": 1, + "zoom_factor": 0, + "channel_averaging_map": [ + [ + 0, + 2 + ], + [ + 744, + 0 + ] + ], + "channel_offset": 0, + "output_link_map": [ + [ + 0, + 0 + ], + [ + 200, + 1 + ] + ] + }, + { + "fsp_id": 2, + "function_mode": "CORR", + "frequency_slice_id": 2, + "integration_factor": 1, + "zoom_factor": 0, + "channel_averaging_map": [ + [ + 0, + 2 + ], + [ + 744, + 0 + ] + ], + "channel_offset": 744, + "output_link_map": [ + [ + 0, + 4 + ], + [ + 200, + 5 + ] + ], + "zoom_window_tuning": 4700000 + } + ] + } + }, + "tmc": { + "scan_duration": 10.0 + }, + "subarray_id": 1, + "sdp": { + "interface": "https://schema.skao.int/ska-sdp-assignres/0.4", + "execution_block": { + "eb_id": "eb-test-20220916-00000", + "max_length": 100.0, + "context": {}, + "beams": [{ + "beam_id": "vis0", + "function": "visibilities" + }], + "scan_types": [{ + "scan_type_id": ".default", + "beams": { + "vis0": { + "channels_id": "vis_channels", + "polarisations_id": "all" + }, + "pss1": { + "field_id": "field_a", + "channels_id": "pulsar_channels", + "polarisations_id": "all" + } + } + }, { + "scan_type_id": "target:a", + "derive_from": ".default", + "beams": { + "vis0": { + "field_id": "field_a" + } + } + }], + "channels": [{ + "channels_id": "vis_channels", + "spectral_windows": [{ + "spectral_window_id": "fsp_1_channels", + "count": 14880, + "start": 0, + "stride": 2, + "freq_min": 350000000.0, + "freq_max": 368000000.0, + "link_map": [[0, 0], [200, 1], [744, 2], [944, 3]] + }] + }, { + "channels_id": "pulsar_channels", + "spectral_windows": [{ + "spectral_window_id": "pulsar_fsp_channels", + "count": 14880, + "start": 0, + "freq_min": 350000000.0, + "freq_max": 368000000.0 + }] + }], + "polarisations": [{ + "polarisations_id": "all", + "corr_type": ["XX", "XY", "YY", "YX"] + }], + "fields": [{ + "field_id": "field_a", + "phase_dir": { + "ra": [123, 0.1], + "dec": [80, 0.1], + "reference_time": "2023-02-16T01:23:45.678900", + "reference_frame": "ICRF3" + }, + "pointing_fqdn": "low-tmc/telstate/0/pointing" + }] + }, + "processing_blocks": [ + { + "pb_id": "pb-mvp01-20200325-00001", + "script": { + "kind": "realtime", + "name": "vis_receive", + "version": "0.1.0" + }, + "parameters": { + } + }, + { + "pb_id": "pb-mvp01-20200325-00002", + "script": { + "kind": "realtime", + "name": "test_realtime", + "version": "0.1.0" + }, + "parameters": { + } + }, + { + "pb_id": "pb-mvp01-20200325-00003", + "script": { + "kind": "batch", + "name": "ical", + "version": "0.1.0" + }, + "parameters": { + }, + "dependencies": [ + { + "pb_id": "pb-mvp01-20200325-00001", + "kind": [ + "visibilities" + ] + } + ], + "sbi_ids": ["sbi-mvp01-20200325-00001"] + }, + { + "pb_id": "pb-mvp01-20200325-00004", + "script": { + "kind": "batch", + "name": "dpreb", + "version": "0.1.0" + }, + "parameters": { + }, + "dependencies": [ + { + "pb_id": "pb-mvp01-20200325-00003", + "kind": [ + "calibration" + ] + } + ] + } + ], + "resources": { + "csp_links": [1, 2, 3, 4] + } + } + } + + \ No newline at end of file diff --git a/tests/telvalidation/test_semantic_validator.py b/tests/telvalidation/test_semantic_validator.py index 2ea06f73..b5fa2bb4 100644 --- a/tests/telvalidation/test_semantic_validator.py +++ b/tests/telvalidation/test_semantic_validator.py @@ -1,3 +1,5 @@ +import json +import os import unittest from datetime import datetime from unittest.mock import patch @@ -33,6 +35,43 @@ def tm_data(): return TMData(sources) +def load_string_from_file(filename): + """ + Return a file from the current directory as a string + """ + cwd, _ = os.path.split(__file__) + path = os.path.join(cwd, filename) + with open(path, "r", encoding="utf-8") as json_file: + json_data = json.load(json_file) + return json_data + + +VALID_MID_ASSIGN_JSON = load_string_from_file( + "test_files/testfile_valid_mid_assign.json" +) +INVALID_MID_ASSIGN_JSON = load_string_from_file( + "test_files/testfile_invalid_mid_assign.json" +) +VALID_MID_CONFIGURE_JSON = load_string_from_file( + "test_files/testfile_valid_mid_configure.json" +) +INVALID_MID_CONFIGURE_JSON = load_string_from_file( + "test_files/testfile_invalid_mid_configure.json" +) +VALID_LOW_ASSIGN_JSON = load_string_from_file( + "test_files/testfile_valid_low_assign.json" +) +INVALID_LOW_ASSIGN_JSON = load_string_from_file( + "test_files/testfile_invalid_low_assign.json" +) +VALID_LOW_CONFIGURE_JSON = load_string_from_file( + "test_files/testfile_valid_low_configure.json" +) +INVALID_LOW_CONFIGURE_JSON = load_string_from_file( + "test_files/testfile_invalid_low_configure.json" +) + + INVALID_MID_VALIDATE_CONSTANT = { "AA0.5": { "assign_resource": { @@ -58,85 +97,9 @@ INPUT_COMMAND_CONFIG = { def test_tmc_assignresources_valid_inputs(tm_data): - assign_ver = tmc_assignresources_uri(2, 1) - config = example_by_uri(assign_ver) - del config["interface"] # to test use of interface key - # sample values that pass semantic only - with pytest.raises( - SchematicValidationError, - match="""interface is missing from config. - Please provide interface='...' explicitly""", - ): - semantic_validate(config, tm_data) - config["interface"] = assign_ver - config["dish"]["receptor_ids"] = ["0001"] - config["sdp"]["execution_block"]["beams"] = [ - {"beam_id": "vis0", "function": "visibilities"} - ] - for channel in config["sdp"]["execution_block"]["channels"]: - if isinstance(channel, dict): - channel["spectral_windows"] = [ - {"spectral_window_id": "fsp_1_channels"} - ] - for channel in config["sdp"]["execution_block"]["channels"]: - for spectral_window in channel["spectral_windows"]: - spectral_window["freq_min"] = 0.5e9 - spectral_window["freq_max"] = 1e9 - spectral_window["count"] = 14880 - config["sdp"]["resources"]["receptors"] = ["0001"] - assert semantic_validate(config, tm_data=tm_data), True - - -def test_tmc_configure_valid_inputs(tm_data): - """Test validations by modifying appropriately - the fields from default example - """ - configure_ver = tmc_configure_uri(2, 1) - config = example_by_uri(configure_ver) - config["interface"] = configure_ver - config["dish"] = {"receiver_band": "1"} - config["csp"]["common"] = {"frequency_band": "1", "subarray_id": 1} - config["csp"]["cbf"]["fsp"] = [{"fsp_id": 1}] - assert semantic_validate(config, tm_data=tm_data) - - -def test_tmc_assign_resources_receptor_ids(tm_data): - """Test validations by modifying appropriately - the fields from default example - """ assign_ver = tmc_assignresources_uri(2, 1) - config = example_by_uri(assign_ver) - del config["interface"] # to test use of interface key - # sample values that pass semantic only - with pytest.raises( - SchematicValidationError, - match="""interface is missing from config. - Please provide interface='...' explicitly""", - ): - semantic_validate(config, tm_data) - config["interface"] = assign_ver - - config["dish"]["receptor_ids"] = [ - "SKA001", - "SKA036", - "SKA048", - "SKA063", - "SKA100", - ] # >4 receptor_ids - with pytest.raises( - SchematicValidationError, - match="receptor_ids are too many!Current Limit is 4", - ): - semantic_validate(config, tm_data=tm_data) - - -def test_tmc_assign_resources_beams(tm_data): - """Test validations by modifying appropriately - the fields from default example - """ - assign_ver = tmc_assignresources_uri(2, 1) - config = example_by_uri(assign_ver) + config = VALID_MID_ASSIGN_JSON del config["interface"] # to test use of interface key # sample values that pass semantic only @@ -145,36 +108,17 @@ def test_tmc_assign_resources_beams(tm_data): match="""interface is missing from config. Please provide interface='...' explicitly""", ): - semantic_validate(config, tm_data=tm_data) + semantic_validate(config, tm_data) config["interface"] = assign_ver - config["sdp"]["execution_block"]["beams"] = [ - {"beam_id": "vis0"}, - {"beam_id": "vis1"}, - ] - with pytest.raises( - SchematicValidationError, - match="beams are too many! Current limit is 1", - ): - semantic_validate(config, tm_data) + assert semantic_validate(config, tm_data=tm_data), True - config["sdp"]["execution_block"]["beams"] = [ - {"beam_id": "vis0", "function": "asdf"} - ] - with pytest.raises( - SchematicValidationError, - match="Invalid function for beams! Currently allowed visibilities", - ): - semantic_validate(config, tm_data) +def test_tmc_assignresources_invalid_inputs(tm_data): -def test_tmc_assign_resources_channels(tm_data): - """Test validations by modifying appropriately - the fields from default example - """ assign_ver = tmc_assignresources_uri(2, 1) - config = example_by_uri(assign_ver) + config = INVALID_MID_ASSIGN_JSON del config["interface"] # to test use of interface key # sample values that pass semantic only @@ -183,193 +127,77 @@ def test_tmc_assign_resources_channels(tm_data): match="""interface is missing from config. Please provide interface='...' explicitly""", ): - semantic_validate(config, tm_data=tm_data) + semantic_validate(config, tm_data) config["interface"] = assign_ver - for channel in config["sdp"]["execution_block"]["channels"]: - channel["spectral_windows"] = [ - {"spectral_window_id": "fsp_1_channels"}, - {"spectral_window_id": "fsp_2_channels"}, - ] - with pytest.raises( - SchematicValidationError, - match="spectral windows are too many! Current limit = 1", - ): - semantic_validate(config, tm_data=tm_data) - - for channel in config["sdp"]["execution_block"]["channels"]: - for spectral_window in channel["spectral_windows"]: - spectral_window["count"] = 744 - with pytest.raises( - SchematicValidationError, - match="Invalid input for channel_count! Currently allowed 14880", - ): + try: semantic_validate(config, tm_data=tm_data) - for channel in config["sdp"]["execution_block"]["channels"]: - for spectral_window in channel["spectral_windows"]: - spectral_window["freq_min"] = 1.5e9 - with pytest.raises( - SchematicValidationError, match="Invalid input for freq_min" - ): - semantic_validate(config, tm_data=tm_data) - - for channel in config["sdp"]["execution_block"]["channels"]: - for spectral_window in channel["spectral_windows"]: - spectral_window["freq_max"] = 1.2e9 - with pytest.raises( - SchematicValidationError, match="Invalid input for freq_max" - ): - semantic_validate(config, tm_data=tm_data) + except SchematicValidationError as error: + assert error.message == ( + "receptor_ids are too many!Current Limit is 4," + "beams are too many! Current limit is 1," + "Invalid function for beams! Currently allowed visibilities," + "spectral windows are too many! Current limit = 1," + "Invalid input for channel_count! Currently allowed 14880," + "Invalid input for freq_min," + "Invalid input for freq_max," + "length of receptor_ids should be same as length of receptors," + "receptor_ids did not match receptors" + ) -def test_tmc_configure_resources_dish(tm_data): +def test_tmc_configure_valid_inputs(tm_data): """Test validations by modifying appropriately the fields from default example """ configure_ver = tmc_configure_uri(2, 1) - config = example_by_uri(configure_ver) - + config = VALID_MID_CONFIGURE_JSON del config["interface"] # to test use of interface key + # sample values that pass semantic only with pytest.raises( SchematicValidationError, match="""interface is missing from config. Please provide interface='...' explicitly""", ): - semantic_validate(config, tm_data=tm_data) + semantic_validate(config, tm_data) config["interface"] = configure_ver - config["dish"] = {"receiver_band": "4"} - with pytest.raises(SchematicValidationError): - semantic_validate(config, tm_data=tm_data) + assert semantic_validate(config, tm_data=tm_data) -def test_tmc_configure_resources_fsp(tm_data): +def test_tmc_configure_invalid_inputs(tm_data): """Test validations by modifying appropriately the fields from default example """ configure_ver = tmc_configure_uri(2, 1) - config = example_by_uri(configure_ver) - # semantic_validate(config) - del config["interface"] # to test use of interface key - with pytest.raises( - SchematicValidationError, - match="""interface is missing from config. - Please provide interface='...' explicitly""", - ): - semantic_validate(config, tm_data=tm_data) - - # sample values that pass semantic only - config["interface"] = configure_ver - - config["csp"]["cbf"]["fsp"] = [{"fsp_id": 7}] - with pytest.raises( - SchematicValidationError, match="Invalid input for fsp_id!" - ): - semantic_validate(config, tm_data=tm_data) - - config["csp"]["cbf"]["fsp"] = [ - {"fsp_id": 1}, - {"fsp_id": 2}, - {"fsp_id": 3}, - {"fsp_id": 4}, - {"fsp_id": 5}, - ] - with pytest.raises( - SchematicValidationError, match="FSPs are too many!Current Limit = 4" - ): - semantic_validate(config, tm_data=tm_data) - - for fsp in config["csp"]["cbf"]["fsp"]: - fsp["function_mode"] = "ASDF" - with pytest.raises( - SchematicValidationError, match="Invalid input for function_mode" - ): - semantic_validate(config, tm_data=tm_data) - - for fsp in config["csp"]["cbf"]["fsp"]: - fsp["zoom_factor"] = 1 - with pytest.raises( - SchematicValidationError, match="Invalid input for zoom_factor" - ): - semantic_validate(config, tm_data=tm_data) - - -def test_dependency_eq_rule_assign_resources(tm_data): - """Test validations by modifying appropriately - the fields from default example - """ - assign_ver = tmc_assignresources_uri(2, 1) - - config = example_by_uri(assign_ver) - + config = INVALID_MID_CONFIGURE_JSON del config["interface"] # to test use of interface key - with pytest.raises( - SchematicValidationError, - match="""interface is missing from config. - Please provide interface='...' explicitly""", - ): - semantic_validate(config, tm_data=tm_data) - # sample values that pass semantic only - config["interface"] = assign_ver - - config["sdp"]["resources"]["receptors"] = [ - "SKA001", - "SKA###", - "SKA063", - "SKA100", - "SKA111", - ] - config["dish"]["receptor_ids"] = ["SKA001", "SKA036", "SKA063", "SKA100"] - with pytest.raises( - SchematicValidationError, - match="length of receptor_ids should be same as length of receptors", - ): - semantic_validate(config, tm_data=tm_data) - - # receptors and receptor_ids identical in length but different - config["dish"]["receptor_ids"] = ["SKA001", "SKA036", "SKA063"] - config["sdp"]["resources"]["receptors"] = ["SKA001", "SKA###", "SKA063"] - with pytest.raises(SchematicValidationError): - semantic_validate(config, tm_data=tm_data) - - -def test_dependency_eq_rule_configure_resources(tm_data): - """Test validations by modifying appropriately - the fields from default example - """ - configure_ver = tmc_configure_uri(2, 1) - config = example_by_uri(configure_ver) - - del config["interface"] # to test use of interface key with pytest.raises( SchematicValidationError, match="""interface is missing from config. Please provide interface='...' explicitly""", ): - semantic_validate(config, tm_data=tm_data) + semantic_validate(config, tm_data) - # sample values that pass semantic only - # validation for "frequency_slice_id"=="fsp_id" config["interface"] = configure_ver - config["csp"]["cbf"]["fsp"] = [{"fsp_id": 2}] - config["csp"]["cbf"]["fsp"] = [{"frequency_slice_id": 4}] - with pytest.raises(SchematicValidationError): + try: semantic_validate(config, tm_data=tm_data) - config["dish"] = {"receiver_band": "1"} - config["csp"]["common"] = {"frequency_band": "3", "subarray_id": 1} - with pytest.raises( - SchematicValidationError, - match="frequency_band did not match receiver_band", - ): - semantic_validate(config, tm_data=tm_data) + except SchematicValidationError as error: + assert error.message == ( + "Invalid input for receiver_band! Currently allowed [1,2]," + "FSPs are too many!Current Limit = 4,Invalid input for fsp_id!," + "Invalid input for function_mode,Invalid input for zoom_factor," + "frequency_slice_id did not match fsp_id," + "frequency_band did not match receiver_band" + ) def test_validate_scemantic_json_input_keys(): @@ -491,8 +319,9 @@ class TestTargetVisibility(unittest.TestCase): def test_tmc_low_assignresources_valid_inputs(tm_data): + assign_ver = low_tmc_assignresources_uri(3, 2) - config = example_by_uri(assign_ver) + config = VALID_LOW_ASSIGN_JSON del config["interface"] # to test use of interface key # sample values that pass semantic only @@ -502,24 +331,15 @@ def test_tmc_low_assignresources_valid_inputs(tm_data): Please provide interface='...' explicitly""", ): semantic_validate(config, tm_data) - config["interface"] = assign_ver - config["sdp"]["execution_block"]["beams"] = [ - {"beam_id": "vis0", "function": "visibilities"} - ] - - for channel in config["sdp"]["execution_block"]["channels"]: - if isinstance(channel, dict): - channel["spectral_windows"] = [ - {"spectral_window_id": "fsp_1_channels"} - ] + config["interface"] = assign_ver - assert semantic_validate(config, tm_data=tm_data) + assert semantic_validate(config, tm_data=tm_data), True def test_tmc_low_assignresources_invalid_inputs(tm_data): assign_ver = low_tmc_assignresources_uri(3, 2) - config = example_by_uri(assign_ver) + config = INVALID_LOW_ASSIGN_JSON del config["interface"] # to test use of interface key # sample values that pass semantic only @@ -529,43 +349,23 @@ def test_tmc_low_assignresources_invalid_inputs(tm_data): Please provide interface='...' explicitly""", ): semantic_validate(config, tm_data) - config["interface"] = assign_ver - config["sdp"]["execution_block"]["beams"] = [ - {"beam_id": "vis0"}, - {"beam_id": "vis1"}, - ] - with pytest.raises( - SchematicValidationError, - match="beams are too many! Current limit is 1", - ): - semantic_validate(config, tm_data) - - config["sdp"]["execution_block"]["beams"] = [ - {"beam_id": "vis0", "function": "asdf"} - ] - with pytest.raises( - SchematicValidationError, - match="Invalid function for beams! Currently allowed visibilities", - ): - semantic_validate(config, tm_data) + config["interface"] = assign_ver - for channel in config["sdp"]["execution_block"]["channels"]: - if isinstance(channel, dict): - channel["spectral_windows"] = [ - {"spectral_window_id": "fsp_1_channels"}, - {"spectral_window_id": "fsp_2_channels"}, - ] - with pytest.raises( - SchematicValidationError, - match="spectral windows are too many! Current limit = 1", - ): + try: semantic_validate(config, tm_data=tm_data) + except SchematicValidationError as error: + assert error.message == ( + "beams are too many! Current limit is 1," + "Invalid function for beams! Currently allowed visibilities," + "spectral windows are too many! Current limit = 1" + ) + def test_tmc_low_configure_valid_inputs(tm_data): configure_ver = low_tmc_configure_uri(3, 1) - config = example_by_uri(configure_ver) + config = VALID_LOW_CONFIGURE_JSON del config["interface"] # to test use of interface key # sample values that pass semantic only @@ -577,159 +377,12 @@ def test_tmc_low_configure_valid_inputs(tm_data): semantic_validate(config, tm_data) config["interface"] = configure_ver - config["csp"]["lowcbf"]["stations"]["stns"] = [ - [1, 1], - [2, 1], - [3, 1], - [4, 1], - [5, 1], - [6, 1], - ] - - config["csp"]["lowcbf"]["vis"]["fsp"]["function_mode"] = "vis" - config["csp"]["lowcbf"]["vis"]["fsp"]["function_mode"] = "vis" - config["csp"]["lowcbf"]["vis"]["fsp"]["fsp_ids"] = [1, 2, 3, 4, 5, 6] assert semantic_validate(config, tm_data) def test_tmc_low_configure_invalid_inputs(tm_data): configure_ver = low_tmc_configure_uri(3, 1) - config = example_by_uri(configure_ver) - del config["interface"] # to test use of interface key - # sample values that pass semantic only - - with pytest.raises( - SchematicValidationError, - match="""interface is missing from config. - Please provide interface='...' explicitly""", - ): - semantic_validate(config, tm_data) - config["interface"] = configure_ver - - config["csp"]["lowcbf"]["stations"]["stns"] = [ - [1, 1], - [2, 1], - [3, 1], - [4, 1], - [5, 1], - [6, 1], - [7, 1], - ] - with pytest.raises( - SchematicValidationError, - match="stations are too many! Current limit is 6", - ): - semantic_validate(config, tm_data=tm_data) - - config["csp"]["lowcbf"]["vis"]["fsp"]["function_mode"] = "abcd" - with pytest.raises( - SchematicValidationError, - match="Invalid input for function mode! Currently allowed vis", - ): - semantic_validate(config, tm_data) - - config["csp"]["lowcbf"]["vis"]["fsp"]["fsp_ids"] = [1, 2, 2, 4, 4, 6] - with pytest.raises( - SchematicValidationError, - match="The fsp_ids should all be distinct", - ): - semantic_validate(config, tm_data) - - -def test_tmc_low_assignresources_beams(tm_data): - assign_ver = low_tmc_assignresources_uri(3, 2) - config = example_by_uri(assign_ver) - del config["interface"] # to test use of interface key - # sample values that pass semantic only - - with pytest.raises( - SchematicValidationError, - match="""interface is missing from config. - Please provide interface='...' explicitly""", - ): - semantic_validate(config, tm_data) - config["interface"] = assign_ver - - config["sdp"]["execution_block"]["beams"] = [{"beam_id": "vis0"}] - assert semantic_validate(config, tm_data=tm_data) - - config["sdp"]["execution_block"]["beams"] = [ - {"beam_id": "vis0"}, - {"beam_id": "vis1"}, - ] - with pytest.raises( - SchematicValidationError, - match="beams are too many! Current limit is 1", - ): - semantic_validate(config, tm_data) - - -def test_tmc_low_assignresources_beams_function(tm_data): - assign_ver = low_tmc_assignresources_uri(3, 2) - config = example_by_uri(assign_ver) - del config["interface"] # to test use of interface key - # sample values that pass semantic only - - with pytest.raises( - SchematicValidationError, - match="""interface is missing from config. - Please provide interface='...' explicitly""", - ): - semantic_validate(config, tm_data) - config["interface"] = assign_ver - - config["sdp"]["execution_block"]["beams"] = [ - {"beam_id": "vis0", "function": "visibilities"} - ] - assert semantic_validate(config, tm_data=tm_data) - - config["sdp"]["execution_block"]["beams"] = [ - {"beam_id": "vis0", "function": "asdf"} - ] - with pytest.raises( - SchematicValidationError, - match="Invalid function for beams! Currently allowed visibilities", - ): - semantic_validate(config, tm_data) - - -def test_tmc_low_assignresources_spectral_windows(tm_data): - assign_ver = low_tmc_assignresources_uri(3, 2) - config = example_by_uri(assign_ver) - del config["interface"] # to test use of interface key - # sample values that pass semantic only - - with pytest.raises( - SchematicValidationError, - match="""interface is missing from config. - Please provide interface='...' explicitly""", - ): - semantic_validate(config, tm_data) - config["interface"] = assign_ver - - for channel in config["sdp"]["execution_block"]["channels"]: - if isinstance(channel, dict): - channel["spectral_windows"] = [ - {"spectral_window_id": "fsp_1_channels"} - ] - assert semantic_validate(config, tm_data=tm_data) - - for channel in config["sdp"]["execution_block"]["channels"]: - if isinstance(channel, dict): - channel["spectral_windows"] = [ - {"spectral_window_id": "fsp_1_channels"}, - {"spectral_window_id": "fsp_2_channels"}, - ] - with pytest.raises( - SchematicValidationError, - match="spectral windows are too many! Current limit = 1", - ): - semantic_validate(config, tm_data=tm_data) - - -def test_tmc_low_configure_stations(tm_data): - configure_ver = low_tmc_configure_uri(3, 1) - config = example_by_uri(configure_ver) + config = INVALID_LOW_CONFIGURE_JSON del config["interface"] # to test use of interface key # sample values that pass semantic only @@ -741,94 +394,13 @@ def test_tmc_low_configure_stations(tm_data): semantic_validate(config, tm_data) config["interface"] = configure_ver - config["csp"]["lowcbf"]["stations"]["stns"] = [ - [1, 1], - [2, 1], - [3, 1], - [4, 1], - [5, 1], - [6, 1], - ] - assert semantic_validate(config, tm_data) - - config["csp"]["lowcbf"]["stations"]["stns"] = [ - [1, 1], - [2, 1], - [3, 1], - [4, 1], - [5, 1], - [6, 1], - [7, 1], - ] - with pytest.raises( - SchematicValidationError, - match="stations are too many! Current limit is 6", - ): + try: semantic_validate(config, tm_data=tm_data) - -def test_tmc_low_configure_function_mode(tm_data): - configure_ver = low_tmc_configure_uri(3, 1) - config = example_by_uri(configure_ver) - del config["interface"] # to test use of interface key - # sample values that pass semantic only - - with pytest.raises( - SchematicValidationError, - match="""interface is missing from config. - Please provide interface='...' explicitly""", - ): - semantic_validate(config, tm_data) - config["interface"] = configure_ver - - config["csp"]["lowcbf"]["vis"]["fsp"]["function_mode"] = "vis" - assert semantic_validate(config, tm_data=tm_data) - - config["csp"]["lowcbf"]["vis"]["fsp"]["function_mode"] = "abcd" - with pytest.raises( - SchematicValidationError, - match="Invalid input for function mode! Currently allowed vis", - ): - semantic_validate(config, tm_data) - - -def test_tmc_low_configure_fsp_ids(tm_data): - configure_ver = low_tmc_configure_uri(3, 1) - config = example_by_uri(configure_ver) - del config["interface"] # to test use of interface key - # sample values that pass semantic only - - with pytest.raises( - SchematicValidationError, - match="""interface is missing from config. - Please provide interface='...' explicitly""", - ): - semantic_validate(config, tm_data) - config["interface"] = configure_ver - - config["csp"]["lowcbf"]["vis"]["fsp"]["fsp_ids"] = [1, 2, 3, 4, 5, 6] - assert semantic_validate(config, tm_data) - - config["csp"]["lowcbf"]["vis"]["fsp"]["fsp_ids"] = [1, 2, 1, 4, 2, 6] - with pytest.raises( - SchematicValidationError, - match="The fsp_ids should all be distinct", - ): - semantic_validate(config, tm_data) - - config["csp"]["lowcbf"]["vis"]["fsp"]["fsp_ids"] = [1, 2, 3, 4, 5, 6, 7] - with pytest.raises( - SchematicValidationError, - match="fsp_ids are too many!Current Limit is 6", - ): - semantic_validate(config, tm_data) - - config["csp"]["lowcbf"]["vis"]["fsp"]["fsp_ids"] = [1, 2, 3, 4, 5, 6, 7, 2] - with pytest.raises( - SchematicValidationError, - match=( + except SchematicValidationError as error: + assert error.message == ( + "stations are too many! Current limit is 6," + "Invalid input for function mode! Currently allowed vis," "The fsp_ids should all be distinct," "fsp_ids are too many!Current Limit is 6" - ), - ): - semantic_validate(config, tm_data) + ) -- GitLab