summaryrefslogtreecommitdiff
path: root/tests/yaml
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2016-12-10 15:37:07 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2016-12-10 15:37:07 +0900
commit22812299a29a6ff4c7d2ee4c140ff54f26cbdba1 (patch)
treed3da1cf3d2a3b3dc4c5ca32c0420f32cb2158434 /tests/yaml
parentc9099f7868eef370839fc5ff02870d50da083676 (diff)
downloadbuildstream-22812299a29a6ff4c7d2ee4c140ff54f26cbdba1.tar.gz
pep8 fixes in yaml test case
Diffstat (limited to 'tests/yaml')
-rw-r--r--tests/yaml/yaml.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/yaml/yaml.py b/tests/yaml/yaml.py
index 12389c499..85ab83d5a 100644
--- a/tests/yaml/yaml.py
+++ b/tests/yaml/yaml.py
@@ -10,6 +10,7 @@ DATA_DIR = os.path.join(
'data',
)
+
@pytest.mark.datafiles(os.path.join(DATA_DIR))
def test_load_yaml(datafiles):
@@ -20,6 +21,7 @@ def test_load_yaml(datafiles):
loaded = _yaml.load(filename)
assert(loaded.get('kind') == 'pony')
+
def assert_provenance(filename, line, col, node, key=None, indices=[]):
provenance = _yaml.node_get_provenance(node, key=key, indices=indices)
@@ -30,11 +32,11 @@ def assert_provenance(filename, line, col, node, key=None, indices=[]):
assert(isinstance(provenance, _yaml.MemberProvenance))
else:
assert(isinstance(provenance, _yaml.DictProvenance))
-
+
assert(provenance.filename == filename)
assert(provenance.line == line)
assert(provenance.col == col)
-
+
@pytest.mark.datafiles(os.path.join(DATA_DIR))
def test_basic_provenance(datafiles):
@@ -48,6 +50,7 @@ def test_basic_provenance(datafiles):
assert_provenance(filename, 1, 0, loaded)
+
@pytest.mark.datafiles(os.path.join(DATA_DIR))
def test_member_provenance(datafiles):
@@ -59,6 +62,7 @@ def test_member_provenance(datafiles):
assert(loaded.get('kind') == 'pony')
assert_provenance(filename, 2, 13, loaded, 'description')
+
@pytest.mark.datafiles(os.path.join(DATA_DIR))
def test_element_provenance(datafiles):
@@ -68,7 +72,8 @@ def test_element_provenance(datafiles):
loaded = _yaml.load(filename)
assert(loaded.get('kind') == 'pony')
- assert_provenance(filename, 5, 2, loaded, 'moods', [ 1 ])
+ assert_provenance(filename, 5, 2, loaded, 'moods', [1])
+
@pytest.mark.datafiles(os.path.join(DATA_DIR))
def test_composited_overwrite_provenance(datafiles):
@@ -88,7 +93,8 @@ def test_composited_overwrite_provenance(datafiles):
assert(overlay.get('kind') == 'horse')
assert_provenance(overlayfile, 1, 0, overlay)
- _yaml.composite_dict(base, overlay, policy=CompositePolicy.OVERWRITE, typesafe=True)
+ _yaml.composite_dict(base, overlay,
+ policy=CompositePolicy.OVERWRITE, typesafe=True)
assert(base.get('kind') == 'horse')
children = base.get('children')
@@ -99,7 +105,7 @@ def test_composited_overwrite_provenance(datafiles):
# The entire children member is overwritten with the overlay
assert_provenance(overlayfile, 4, 0, base, 'children')
- assert_provenance(overlayfile, 4, 2, base, 'children', [ 0 ])
+ assert_provenance(overlayfile, 4, 2, base, 'children', [0])
# The child dict itself has the overlay provenance
child = children[0]
@@ -124,7 +130,8 @@ def test_composited_array_append_provenance(datafiles):
assert(overlay.get('kind') == 'horse')
assert_provenance(overlayfile, 1, 0, overlay)
- _yaml.composite_dict(base, overlay, policy=CompositePolicy.ARRAY_APPEND, typesafe=True)
+ _yaml.composite_dict(base, overlay,
+ policy=CompositePolicy.ARRAY_APPEND, typesafe=True)
assert(base.get('kind') == 'horse')
children = base.get('children')
@@ -135,7 +142,7 @@ def test_composited_array_append_provenance(datafiles):
assert_provenance(filename, 7, 0, base, 'children')
# The newly added element has the overlay provenance
- assert_provenance(overlayfile, 4, 2, base, 'children', [ 7 ])
+ assert_provenance(overlayfile, 4, 2, base, 'children', [7])
# The child dict itself has the overlay provenance
child = children[7]
@@ -154,8 +161,6 @@ def test_composited_array_append_provenance(datafiles):
assert_provenance(overlayfile, 8, 4, another)
-
-
@pytest.mark.datafiles(os.path.join(DATA_DIR))
def test_node_get(datafiles):
@@ -170,7 +175,9 @@ def test_node_get(datafiles):
assert(base.get('kind') == 'pony')
overlay = _yaml.load(overlayfile)
assert(overlay.get('kind') == 'horse')
- _yaml.composite_dict(base, overlay, policy=CompositePolicy.ARRAY_APPEND, typesafe=True)
+ _yaml.composite_dict(base, overlay,
+ policy=CompositePolicy.ARRAY_APPEND,
+ typesafe=True)
assert(base.get('kind') == 'horse')
children = _yaml.node_get(base, list, 'children')