diff --git a/nomad/app/optimade/filterparser.py b/nomad/app/optimade/filterparser.py index 9f51b6dc83c56d9fa2dfe283cba83f975f739520..ca85b236e5d20441930d3a9ca70c6d6916274583 100644 --- a/nomad/app/optimade/filterparser.py +++ b/nomad/app/optimade/filterparser.py @@ -123,7 +123,15 @@ class ElasticTransformer(OPTElasticTransformer): if quantity.elastic_mapping_type == 'text': query_type = 'match' - elif quantity.elastic_mapping_type in ['keyword', 'integer', 'float', 'bool']: + elif quantity.elastic_mapping_type in [ + 'keyword', + 'short', + 'integer', + 'long', + 'float', + 'double', + 'bool', + ]: query_type = 'term' else: raise NotImplementedError('Quantity has unsupported ES field type') diff --git a/nomad/normalizing/results.py b/nomad/normalizing/results.py index a301e1838e767b21f411e598a4a065fa23b0a651..936e91583415e24f4ea425956e7581384e460598 100644 --- a/nomad/normalizing/results.py +++ b/nomad/normalizing/results.py @@ -1059,7 +1059,11 @@ class ResultsNormalizer(Normalizer): msd.diffusion_constant_error_type = ( diffusion_constant.error_type ) - msd.diffusion_constant_errors = diffusion_constant.errors + msd.diffusion_constant_errors = ( + diffusion_constant.errors + if isinstance(diffusion_constant.errors, list) + else [diffusion_constant.errors] + ) md = self.get_md_provenance( msd_workflow.m_parent.m_parent.m_parent diff --git a/tests/data/plugins/perovskite_solar_cell_database/example.archive.json b/tests/data/plugins/perovskite_solar_cell_database/example.archive.json index 59f744665d368aace59bc3c39aa30b4b747a9a05..39767f81bcc596f89365968d1ae281bfcc335ede 100644 --- a/tests/data/plugins/perovskite_solar_cell_database/example.archive.json +++ b/tests/data/plugins/perovskite_solar_cell_database/example.archive.json @@ -73,7 +73,7 @@ "composition_leadfree": false, "additives_compounds": "Cl", "band_gap": 1.6, - "band_gap_graded": false, + "band_gap_graded": "false", "band_gap_estimation_basis": "Composition", "storage_time_until_next_deposition_step": "Unknown", "storage_atmosphere": "Unknown" diff --git a/tests/metainfo/test_metainfo.py b/tests/metainfo/test_metainfo.py index 4a2d3224f87300dbd5099e51d6264ced45cc5183..565c46944116f5de058ef429d4705f6f8bbd2e05 100644 --- a/tests/metainfo/test_metainfo.py +++ b/tests/metainfo/test_metainfo.py @@ -650,7 +650,7 @@ class TestM1: def test_pd_dataframe_quantity(self): class TestSection(MSection): - test_quantity = Quantity(type=np.dtype('int32')) + test_quantity = Quantity(type=np.dtype('int32'), shape=['*', '*']) test_section = TestSection() test_section.test_quantity = pd.DataFrame([[1, 2]]) @@ -790,7 +790,7 @@ class TestM1: def test_validate_dimension(self): system = System() system.atom_labels = ['H'] - system.atom_positions = [] + system.atom_positions = [[]] assert len(system.m_validate()) > 0 def test_multiple_sub_sections(self): diff --git a/tests/metainfo/test_quantities.py b/tests/metainfo/test_quantities.py index 422a855e4265bea1e3c6e2aeaf312c7823fac01e..3e57b2386d8f05126fd0ec38ee04e47671b4595e 100644 --- a/tests/metainfo/test_quantities.py +++ b/tests/metainfo/test_quantities.py @@ -159,7 +159,7 @@ def test_normalization_string(def_type, orig_value, normalized_value): + [ pytest.param( int, - 'm', + 'inch', [], 100 * units('m'), 100 * units('m'), @@ -299,8 +299,8 @@ def test_complex_number(unit, quantity_type, value, shape): 'im': [[1, 2, 3], [4, 5, 6]], }, # no shape checking anyway np.array([[1, 2, 3], [4, 5, 6]]) + 1j * np.array([[1, 2, 3], [4, 5, 6]]), - ['*'], - id='complex-full', + ['*', '*'], + id='complex-full-2nd', ), ], ) @@ -327,8 +327,6 @@ def test_complex_number_dict(unit, quantity_type, value, result, shape): 'quantity_type,value', [ pytest.param(np.complex128, np.int64(1), id='downcast-from-int-128'), - pytest.param(np.complex64, {'re': 1}, id='downcast-from-int-64'), - pytest.param(np.complex64, {'re': 1.25}, id='downcast-from-float-64'), pytest.param(np.complex128, {'re': [1.25, 1], 'im': 1}, id='mismatch-shape'), pytest.param(np.complex128, {}, id='empty-dict'), ], diff --git a/tests/normalizing/test_properties.py b/tests/normalizing/test_properties.py index 80a3b4a80d9a7827dd88cc93e25479e6afad2180..ad82111b390280fb02528becf149458c473bcca5 100644 --- a/tests/normalizing/test_properties.py +++ b/tests/normalizing/test_properties.py @@ -495,7 +495,7 @@ def test_msds(molecular_dynamics): 2.1, ) assert msd.diffusion_constant_error_type == 'Pearson correlation coefficient' - assert np.array_equal(msd.diffusion_constant_errors, 0.98) + assert np.array_equal(msd.diffusion_constant_errors, [0.98]) @pytest.mark.skipif(simulationworkflowschema is None, reason=SCHEMA_IMPORT_ERROR)