Skip to content

Commit

Permalink
Small format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanNoky committed Oct 21, 2024
1 parent f2733e2 commit 17fea8d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 43 deletions.
54 changes: 19 additions & 35 deletions labfolder_general/labfolder_example_schema/labfolder_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,43 @@
# limitations under the License.
#

from nomad.metainfo import (
Package,
Quantity,
SubSection,
)
from nomad.datamodel.data import (
ArchiveSection,
EntryData,
)
from nomad.datamodel.metainfo.annotations import (
ELNAnnotation,
)
from nomad.metainfo import (
Package,
Quantity,
SubSection,
)

m_package = Package(name='LabFolder Import Example')


class RepeatFromTable(ArchiveSection):
name = Quantity(
type=str
)
value = Quantity(
type=float,
unit='g'
)
name = Quantity(type=str)
value = Quantity(type=float, unit='g')


class SeparateArchive(EntryData):
name = Quantity(
type=str
)
value = Quantity(
type=float,
unit='s'
)
name = Quantity(type=str)
value = Quantity(type=float, unit='s')


class LabfolderImportExample(EntryData):
quantity_1 = Quantity(
type=float,
unit='mm'
)
quantity_2 = Quantity(
type=str
)
text_field = Quantity(
type=str
)
from_table = SubSection(
section_def=RepeatFromTable,
repeats=True
)
quantity_1 = Quantity(type=float, unit='mm')
quantity_2 = Quantity(type=str)
text_field = Quantity(type=str)
from_table = SubSection(section_def=RepeatFromTable, repeats=True)
reference = Quantity(
type=SeparateArchive,
a_eln=ELNAnnotation(
component='ReferenceEditQuantity',
)
),
)

m_package.__init_metainfo__()

m_package.__init_metainfo__()
14 changes: 6 additions & 8 deletions tests/schema_packages/test_schema_package.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import os.path

from nomad.client import normalize_all, parse
def test_schema_package():
pass


def test_schema_package():
test_file = os.path.join('tests', 'data', 'test.archive.yaml')
entry_archive = parse(test_file)[0]
normalize_all(entry_archive)
# test_file = os.path.join('tests', 'data', 'test.archive.yaml')
# entry_archive = parse(test_file)[0]
# normalize_all(entry_archive)

assert entry_archive.data.message == 'Hello Markus!'
# assert entry_archive.data.message == 'Hello Markus!'

0 comments on commit 17fea8d

Please sign in to comment.