From 4f2c4d80b92f39a088d7b9285d1b88de64c7117d Mon Sep 17 00:00:00 2001 From: Yann Lanthony Date: Fri, 1 Feb 2019 16:04:09 +0100 Subject: [PATCH] [tests] multiviewPipeline: add de/serialization testing --- tests/test_multiviewPipeline.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_multiviewPipeline.py b/tests/test_multiviewPipeline.py index c85e3729..c5ef6d86 100644 --- a/tests/test_multiviewPipeline.py +++ b/tests/test_multiviewPipeline.py @@ -1,6 +1,11 @@ #!/usr/bin/env python # coding:utf-8 +import os +import tempfile + import meshroom.multiview +from meshroom.core.graph import loadGraph +from meshroom.core.node import Node def test_multiviewPipeline(): @@ -83,3 +88,14 @@ def test_multiviewPipeline(): for uidIndex in attr.desc.uid: assert attr.uid(uidIndex) == otherAttr.uid(uidIndex) + # test serialization/deserialization + for graph in [graph1, graph2, graph3, graph4]: + filename = tempfile.mktemp() + graph.save(filename) + loadedGraph = loadGraph(filename) + os.remove(filename) + # check that all nodes have been properly de-serialized + # - same node set + assert sorted([n.name for n in loadedGraph.nodes]) == sorted([n.name for n in graph.nodes]) + # - no compatibility issues + assert all(isinstance(n, Node) for n in loadedGraph.nodes)