Skip to content
Snippets Groups Projects
Commit 611bd4b1 authored by I. Nüske's avatar I. Nüske
Browse files

STY: Autopep

parent e8ad31d3
No related branches found
No related tags found
2 merge requests!159Release 0.16.o,!155Review filter lists and compare_entities
Pipeline #57139 passed with warnings
......@@ -136,7 +136,6 @@ def test_compare_entities():
assert "tests_234234" in diff_r1["properties"]
assert "tests_TT" in diff_r2["properties"]
# test compare units of properties
r1 = db.Record()
r2 = db.Record()
......@@ -174,7 +173,7 @@ def test_compare_entities_battery():
prop2 = db.Property(name="Property 2")
prop3 = db.Property()
## Basic tests for Properties
# Basic tests for Properties
prop_settings = {"datatype": db.REFERENCE, "description": "desc of prop",
"value": db.Record().add_parent(par3), "unit": '°'}
t1 = db.Record().add_parent(db.RecordType())
......@@ -226,7 +225,7 @@ def test_compare_entities_battery():
diff_0[1]["properties"].pop("value copy")
assert diff_0 == diff_1
## Basic tests for Parents
# Basic tests for Parents
t3 = db.Record().add_parent(db.RecordType("A")).add_parent(db.Record("B"))
t4 = db.Record().add_parent(db.RecordType("A"))
assert compare_entities(t3, t4)[0]['parents'] == ['B']
......@@ -241,7 +240,7 @@ def test_compare_entities_battery():
t4.add_parent(db.RecordType("B")).add_parent(db.Record("A"))
assert empty_diff(t3, t4)
## Basic tests for special attributes
# Basic tests for special attributes
prop_settings = {"id": 42, "name": "Property",
"datatype": db.LIST(db.REFERENCE), "value": [db.Record()],
"unit": '', "description": "desc of prop"}
......@@ -310,7 +309,7 @@ def test_compare_entities_battery():
db.Property(value=db.Record(id=101)),
compare_referenced_records=True)
## Special cases
# Special cases
# Files
assert not empty_diff(db.File(path='ABC', file=StringIO("ABC")),
db.File(path='ABC', file=StringIO("Other")))
......@@ -411,7 +410,6 @@ def test_compare_special_properties():
assert len(diff_r1["properties"]) == 0
assert len(diff_r2["properties"]) == 0
# compare Property objects
p1 = db.Property()
p2 = db.Property()
......
......@@ -179,7 +179,7 @@ def test_filter():
r6 = Record(id=105, name="R")
test_ents = [rt1, rt2, rt3, p1, p2, p3, p4, p5, p6, r1, r2, r3, r4, r5, r6]
### Setup
# Setup
t1 = Property()
t1_props, t1_pars = t1.properties, t1.parents
t2 = Record()
......@@ -192,10 +192,10 @@ def test_filter():
assert ent not in coll
assert ent not in coll.filter(ent)
### Checks with each type
# Checks with each type
for t, t_props, t_pars in [(t1, t1_props, t1_pars), (t2, t2_props, t2_pars),
(t3, t3_props, t3_pars)]:
## Properties
# Properties
# Basic Checks
t.add_property(p1)
t.add_property(p3)
......@@ -213,7 +213,7 @@ def test_filter():
assert entity not in t_props.filter(pid=100)
assert p2 in t_props.filter(entity)
## Parents
# Parents
# Filtering with both name and id
t.add_parent(r3)
t.add_parent(r5)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment