Skip to content
Snippets Groups Projects
Verified Commit 68e7681b authored by Timm Fitschen's avatar Timm Fitschen
Browse files

STY: autopep8'ed test_file.py

parent 0db1530b
Branches
No related tags found
1 merge request!49Draft: ENH: file system: directory
Pipeline #47498 failed
......@@ -476,7 +476,8 @@ def test_delete_dir_failure_not_empty():
with raises(TransactionError) as exc:
directoryA.delete()
assert exc.value.msg == "One or more entities are not qualified. None of them have been inserted/updated/deleted."
assert exc.value.entities[0].get_errors()[0].description == "Entity is required by other entities which are not to be deleted."
assert exc.value.entities[0].get_errors(
)[0].description == "Entity is required by other entities which are not to be deleted."
body = get_connection().retrieve(
entity_uri_segments=[
......
# encoding: utf-8
#
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2022 IndiScale GmbH <info@indiscale.com>
# Copyright (C) 2022 Timm Fitschen <t.fitschen@indiscale.com>
#
# 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 caosdb as db
def setup_module():
teardown_module()
db.RecordType("State").insert()
db.RecordType("StateModel").insert()
db.RecordType("Transition").insert()
db.Property(name="from", datatype="State").insert()
db.Property(name="to", datatype="State").insert()
db.Property(name="initial", datatype="State").insert()
db.Property(name="final", datatype="State").insert()
def teardown_module():
"""delete all entities!!!"""
try:
db.execute_query("FIND ENTITY").delete()
except:
pass
def create_transition(name, fro, to):
db.Record(name).add_parent("Transition").add_property(
"from", fro).add_property("to", to).insert()
def create_state_model(name, transitions, initial, final):
m = db.Record(name)
m.add_parent("StateModel")
m.add_property("Transition",
datatype=db.LIST("Transition"),
value=transitions)
m.add_property("initial", initial)
m.add_property("final", final)
m.insert()
def test_issue_86():
# two states
db.Record("S1").add_parent("State").insert()
db.Record("S2").add_parent("State").insert()
# three transitions
create_transition("t11", "S1", "S1")
create_transition("t12", "S1", "S2")
create_transition("t21", "S2", "S1")
create_state_model("Model1", ["t11", "t12", "t21"], "S1", "S1")
# stateful record type
rt = db.RecordType("TestRT")
rt.state = db.State(model="Model1", name="S1")
rt.insert()
# record inherits the state from the record type.
rec = db.Record().add_parent("TestRT")
rec.insert()
assert rec.state == db.State(model="Model1", name="S1")
# now try to update the record without changing the state.
p = db.Property("p1", datatype=db.TEXT).insert()
rec.add_property(p, value="val1").update()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment