Skip to content
Snippets Groups Projects
Commit 9ed5f51c authored by florian's avatar florian
Browse files

MAINT: autopep8'd and added licence header

parent 57e865ac
No related branches found
No related tags found
2 merge requests!160STY: styling,!131Accept references of children
Pipeline #41213 passed
# encoding: utf-8
#
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2021 Henrik tom Wörden <h.tomwoerden@indiscale.com>
# 2021-2023 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
# Alexander Schlemmer <alexander.schlemmer@ds.mpg.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
import json
import logging
......@@ -277,6 +299,7 @@ def test_variable_deletion_problems():
else:
raise RuntimeError("Wrong name")
def test_record_parents():
""" Test the correct list of returned records by the scanner """
......@@ -288,20 +311,20 @@ def test_record_parents():
converter_registry = create_converter_registry(crawler_definition)
records = scan_structure_elements(DictElement(name="", value=data), crawler_definition,
converter_registry)
assert len(records)==4
converter_registry)
assert len(records) == 4
for rec in records:
if rec.name == 'e':
assert rec.parents[0].name == 'Exp' # default parent was overwritten
assert len(rec.parents)==1
assert rec.parents[0].name == 'Exp' # default parent was overwritten
assert len(rec.parents) == 1
elif rec.name == 'c':
assert rec.parents[0].name == 'Cap2' # default parent was overwritten by second
# converter
assert len(rec.parents)==1
assert rec.parents[0].name == 'Cap2' # default parent was overwritten by second
# converter
assert len(rec.parents) == 1
elif rec.name == 'p':
assert rec.parents[0].name == 'Projekt' # top level set parent was overwritten
assert len(rec.parents)==1
assert rec.parents[0].name == 'Projekt' # top level set parent was overwritten
assert len(rec.parents) == 1
elif rec.name == 's':
assert rec.parents[0].name == 'Stuff' # default parent stays if no parent is given on
# lower levels
assert len(rec.parents)==1
assert rec.parents[0].name == 'Stuff' # default parent stays if no parent is given on
# lower levels
assert len(rec.parents) == 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment