Commit afa3fef9 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Minor fixes.

parent b91a3064
Pipeline #45240 passed with stages
in 25 minutes and 16 seconds
......@@ -37,6 +37,12 @@ class RepositoryNormalizer(Normalizer):
}
""" https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-meta-info/wikis/metainfo/XC-functional """
basis_sets = {
'gaussians': 'gaussians',
'realspacegrid': 'real-space grid',
'planewaves': 'plane waves'
}
version_re = re.compile(r'(\d+(\.\d+(\.\d+)?)?)')
def map_functional_name_to_xc_treatment(self, name):
......@@ -45,6 +51,10 @@ class RepositoryNormalizer(Normalizer):
return RepositoryNormalizer.xc_treatments.get(name[:3].lower(), name)
def map_basis_set_to_basis_set_label(self, name):
key = name.replace('_', '').replace('-', '').replace(' ', '').lower()
return RepositoryNormalizer.basis_sets.get(key, name)
def simplify_version(self, version):
match = RepositoryNormalizer.version_re.search(version)
if match is None:
......@@ -123,7 +133,8 @@ class RepositoryNormalizer(Normalizer):
self.get_optional_value('international_short_symbol', 'section_symmetry', 0))
b.addValue(
'repository_basis_set_type',
self.get_optional_value('program_basis_set_type', 'section_run'))
self.map_basis_set_to_basis_set_label(
self.get_optional_value('program_basis_set_type', 'section_run')))
b.addValue(
'repository_system_type',
self.get_optional_value('system_type', 'section_system'))
......
......@@ -59,7 +59,7 @@ def nomad_logging():
def raw_files_infra(monkeysession):
monkeysession.setattr('nomad.config.fs', config.FSConfig(
tmp='.volumes/test_fs/tmp', staging='.volumes/test_fs/staging',
public='.volumes/test_fs/public'))
public='.volumes/test_fs/public', prefix_size=2))
@pytest.fixture(scope='function')
......
......@@ -67,7 +67,7 @@ class TestObjects:
directory = DirectoryObject(test_bucket, dirpath, create=create, prefix=prefix)
assert directory.exists() == create
assert os.path.isdir(directory.os_path) == create
assert directory.os_path.endswith(os.path.join('tes' if prefix else '', 'test'))
assert directory.os_path.endswith(os.path.join('te' if prefix else '', 'test'))
@pytest.mark.parametrize('dirpath', ['test', os.path.join('sub', 'test')])
@pytest.mark.parametrize('create', [True, False])
......@@ -96,7 +96,7 @@ class TestObjects:
dir_2.delete()
prefix = os.path.dirname(dir_2.os_path)
assert len(os.path.basename(prefix)) == 3
assert len(os.path.basename(prefix)) == 2
assert not os.path.exists(prefix)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment