mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-06 04:41:58 +02:00
[tests] Update unit tests with new UID system
This commit is contained in:
parent
e5ac6bd0dc
commit
d67062d39d
6 changed files with 39 additions and 41 deletions
|
@ -10,28 +10,28 @@ class AppendFiles(desc.CommandLineNode):
|
||||||
label='Input File',
|
label='Input File',
|
||||||
description='''''',
|
description='''''',
|
||||||
value='',
|
value='',
|
||||||
uid=[0],
|
invalidate=True,
|
||||||
),
|
),
|
||||||
desc.File(
|
desc.File(
|
||||||
name='input2',
|
name='input2',
|
||||||
label='Input File 2',
|
label='Input File 2',
|
||||||
description='''''',
|
description='''''',
|
||||||
value='',
|
value='',
|
||||||
uid=[0],
|
invalidate=True,
|
||||||
),
|
),
|
||||||
desc.File(
|
desc.File(
|
||||||
name='input3',
|
name='input3',
|
||||||
label='Input File 3',
|
label='Input File 3',
|
||||||
description='''''',
|
description='''''',
|
||||||
value='',
|
value='',
|
||||||
uid=[0],
|
invalidate=True,
|
||||||
),
|
),
|
||||||
desc.File(
|
desc.File(
|
||||||
name='input4',
|
name='input4',
|
||||||
label='Input File 4',
|
label='Input File 4',
|
||||||
description='''''',
|
description='''''',
|
||||||
value='',
|
value='',
|
||||||
uid=[0],
|
invalidate=True,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class AppendFiles(desc.CommandLineNode):
|
||||||
label='Output',
|
label='Output',
|
||||||
description='''''',
|
description='''''',
|
||||||
value=desc.Node.internalFolder + 'appendText.txt',
|
value=desc.Node.internalFolder + 'appendText.txt',
|
||||||
uid=[],
|
invalidate=False,
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,14 @@ class AppendText(desc.CommandLineNode):
|
||||||
label='Input File',
|
label='Input File',
|
||||||
description='''''',
|
description='''''',
|
||||||
value='',
|
value='',
|
||||||
uid=[0],
|
invalidate=True,
|
||||||
),
|
),
|
||||||
desc.File(
|
desc.File(
|
||||||
name='inputText',
|
name='inputText',
|
||||||
label='Input Text',
|
label='Input Text',
|
||||||
description='''''',
|
description='''''',
|
||||||
value='',
|
value='',
|
||||||
uid=[0],
|
invalidate=True,
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -27,6 +27,6 @@ class AppendText(desc.CommandLineNode):
|
||||||
label='Output',
|
label='Output',
|
||||||
description='''''',
|
description='''''',
|
||||||
value=desc.Node.internalFolder + 'appendText.txt',
|
value=desc.Node.internalFolder + 'appendText.txt',
|
||||||
uid=[],
|
invalidate=False,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Ls(desc.CommandLineNode):
|
||||||
label='Input',
|
label='Input',
|
||||||
description='''''',
|
description='''''',
|
||||||
value='',
|
value='',
|
||||||
uid=[0],
|
invalidate=True,
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -19,6 +19,6 @@ class Ls(desc.CommandLineNode):
|
||||||
label='Output',
|
label='Output',
|
||||||
description='''''',
|
description='''''',
|
||||||
value=desc.Node.internalFolder + 'ls.txt',
|
value=desc.Node.internalFolder + 'ls.txt',
|
||||||
uid=[],
|
invalidate=False,
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
|
@ -15,17 +15,17 @@ from meshroom.core.node import CompatibilityNode, CompatibilityIssue, Node
|
||||||
|
|
||||||
|
|
||||||
SampleGroupV1 = [
|
SampleGroupV1 = [
|
||||||
desc.IntParam(name="a", label="a", description="", value=0, uid=[0], range=None),
|
desc.IntParam(name="a", label="a", description="", value=0, invalidate=True, range=None),
|
||||||
desc.ListAttribute(
|
desc.ListAttribute(
|
||||||
name="b",
|
name="b",
|
||||||
elementDesc=desc.FloatParam(name="p", label="", description="", value=0.0, uid=[0], range=None),
|
elementDesc=desc.FloatParam(name="p", label="", description="", value=0.0, invalidate=True, range=None),
|
||||||
label="b",
|
label="b",
|
||||||
description="",
|
description="",
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
SampleGroupV2 = [
|
SampleGroupV2 = [
|
||||||
desc.IntParam(name="a", label="a", description="", value=0, uid=[0], range=None),
|
desc.IntParam(name="a", label="a", description="", value=0, invalidate=True, range=None),
|
||||||
desc.ListAttribute(
|
desc.ListAttribute(
|
||||||
name="b",
|
name="b",
|
||||||
elementDesc=desc.GroupAttribute(name="p", label="", description="", groupDesc=SampleGroupV1),
|
elementDesc=desc.GroupAttribute(name="p", label="", description="", groupDesc=SampleGroupV1),
|
||||||
|
@ -36,8 +36,8 @@ SampleGroupV2 = [
|
||||||
|
|
||||||
#SampleGroupV3 is SampleGroupV2 with one more int parameter
|
#SampleGroupV3 is SampleGroupV2 with one more int parameter
|
||||||
SampleGroupV3 = [
|
SampleGroupV3 = [
|
||||||
desc.IntParam(name="a", label="a", description="", value=0, uid=[0], range=None),
|
desc.IntParam(name="a", label="a", description="", value=0, invalidate=True, range=None),
|
||||||
desc.IntParam(name="notInSampleGroupV2", label="notInSampleGroupV2", description="", value=0, uid=[0], range=None),
|
desc.IntParam(name="notInSampleGroupV2", label="notInSampleGroupV2", description="", value=0, invalidate=True, range=None),
|
||||||
desc.ListAttribute(
|
desc.ListAttribute(
|
||||||
name="b",
|
name="b",
|
||||||
elementDesc=desc.GroupAttribute(name="p", label="", description="", groupDesc=SampleGroupV1),
|
elementDesc=desc.GroupAttribute(name="p", label="", description="", groupDesc=SampleGroupV1),
|
||||||
|
@ -50,11 +50,11 @@ SampleGroupV3 = [
|
||||||
class SampleNodeV1(desc.Node):
|
class SampleNodeV1(desc.Node):
|
||||||
""" Version 1 Sample Node """
|
""" Version 1 Sample Node """
|
||||||
inputs = [
|
inputs = [
|
||||||
desc.File(name='input', label='Input', description='', value='', uid=[0],),
|
desc.File(name='input', label='Input', description='', value='', invalidate=True,),
|
||||||
desc.StringParam(name='paramA', label='ParamA', description='', value='', uid=[]) # No impact on UID
|
desc.StringParam(name='paramA', label='ParamA', description='', value='', invalidate=False) # No impact on UID
|
||||||
]
|
]
|
||||||
outputs = [
|
outputs = [
|
||||||
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, uid=[])
|
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, invalidate=False)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,11 +63,11 @@ class SampleNodeV2(desc.Node):
|
||||||
* 'input' has been renamed to 'in'
|
* 'input' has been renamed to 'in'
|
||||||
"""
|
"""
|
||||||
inputs = [
|
inputs = [
|
||||||
desc.File(name='in', label='Input', description='', value='', uid=[0],),
|
desc.File(name='in', label='Input', description='', value='', invalidate=True,),
|
||||||
desc.StringParam(name='paramA', label='ParamA', description='', value='', uid=[]), # No impact on UID
|
desc.StringParam(name='paramA', label='ParamA', description='', value='', invalidate=False), # No impact on UID
|
||||||
]
|
]
|
||||||
outputs = [
|
outputs = [
|
||||||
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, uid=[])
|
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, invalidate=False)
|
||||||
]
|
]
|
||||||
|
|
||||||
class SampleNodeV3(desc.Node):
|
class SampleNodeV3(desc.Node):
|
||||||
|
@ -76,10 +76,10 @@ class SampleNodeV3(desc.Node):
|
||||||
* 'paramA' has been removed'
|
* 'paramA' has been removed'
|
||||||
"""
|
"""
|
||||||
inputs = [
|
inputs = [
|
||||||
desc.File(name='in', label='Input', description='', value='', uid=[0], ),
|
desc.File(name='in', label='Input', description='', value='', invalidate=True, ),
|
||||||
]
|
]
|
||||||
outputs = [
|
outputs = [
|
||||||
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, uid=[])
|
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, invalidate=False)
|
||||||
]
|
]
|
||||||
|
|
||||||
class SampleNodeV4(desc.Node):
|
class SampleNodeV4(desc.Node):
|
||||||
|
@ -88,14 +88,14 @@ class SampleNodeV4(desc.Node):
|
||||||
* 'paramA' has been added
|
* 'paramA' has been added
|
||||||
"""
|
"""
|
||||||
inputs = [
|
inputs = [
|
||||||
desc.File(name='in', label='Input', description='', value='', uid=[0], ),
|
desc.File(name='in', label='Input', description='', value='', invalidate=True, ),
|
||||||
desc.ListAttribute(name='paramA', label='ParamA',
|
desc.ListAttribute(name='paramA', label='ParamA',
|
||||||
elementDesc=desc.GroupAttribute(
|
elementDesc=desc.GroupAttribute(
|
||||||
groupDesc=SampleGroupV1, name='gA', label='gA', description=''),
|
groupDesc=SampleGroupV1, name='gA', label='gA', description=''),
|
||||||
description='')
|
description='')
|
||||||
]
|
]
|
||||||
outputs = [
|
outputs = [
|
||||||
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, uid=[])
|
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, invalidate=False)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,14 +105,14 @@ class SampleNodeV5(desc.Node):
|
||||||
* 'paramA' elementDesc has changed from SampleGroupV1 to SampleGroupV2
|
* 'paramA' elementDesc has changed from SampleGroupV1 to SampleGroupV2
|
||||||
"""
|
"""
|
||||||
inputs = [
|
inputs = [
|
||||||
desc.File(name='in', label='Input', description='', value='', uid=[0]),
|
desc.File(name='in', label='Input', description='', value='', invalidate=True),
|
||||||
desc.ListAttribute(name='paramA', label='ParamA',
|
desc.ListAttribute(name='paramA', label='ParamA',
|
||||||
elementDesc=desc.GroupAttribute(
|
elementDesc=desc.GroupAttribute(
|
||||||
groupDesc=SampleGroupV2, name='gA', label='gA', description=''),
|
groupDesc=SampleGroupV2, name='gA', label='gA', description=''),
|
||||||
description='')
|
description='')
|
||||||
]
|
]
|
||||||
outputs = [
|
outputs = [
|
||||||
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, uid=[])
|
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, invalidate=False)
|
||||||
]
|
]
|
||||||
|
|
||||||
class SampleNodeV6(desc.Node):
|
class SampleNodeV6(desc.Node):
|
||||||
|
@ -121,23 +121,23 @@ class SampleNodeV6(desc.Node):
|
||||||
* 'paramA' elementDesc has changed from SampleGroupV2 to SampleGroupV3
|
* 'paramA' elementDesc has changed from SampleGroupV2 to SampleGroupV3
|
||||||
"""
|
"""
|
||||||
inputs = [
|
inputs = [
|
||||||
desc.File(name='in', label='Input', description='', value='', uid=[0]),
|
desc.File(name='in', label='Input', description='', value='', invalidate=True),
|
||||||
desc.ListAttribute(name='paramA', label='ParamA',
|
desc.ListAttribute(name='paramA', label='ParamA',
|
||||||
elementDesc=desc.GroupAttribute(
|
elementDesc=desc.GroupAttribute(
|
||||||
groupDesc=SampleGroupV3, name='gA', label='gA', description=''),
|
groupDesc=SampleGroupV3, name='gA', label='gA', description=''),
|
||||||
description='')
|
description='')
|
||||||
]
|
]
|
||||||
outputs = [
|
outputs = [
|
||||||
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, uid=[])
|
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, invalidate=False)
|
||||||
]
|
]
|
||||||
|
|
||||||
class SampleInputNodeV1(desc.InputNode):
|
class SampleInputNodeV1(desc.InputNode):
|
||||||
""" Version 1 Sample Input Node """
|
""" Version 1 Sample Input Node """
|
||||||
inputs = [
|
inputs = [
|
||||||
desc.StringParam(name='path', label='path', description='', value='', uid=[]) # No impact on UID
|
desc.StringParam(name='path', label='path', description='', value='', invalidate=False) # No impact on UID
|
||||||
]
|
]
|
||||||
outputs = [
|
outputs = [
|
||||||
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, uid=[])
|
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, invalidate=False)
|
||||||
]
|
]
|
||||||
|
|
||||||
class SampleInputNodeV2(desc.InputNode):
|
class SampleInputNodeV2(desc.InputNode):
|
||||||
|
@ -145,10 +145,10 @@ class SampleInputNodeV2(desc.InputNode):
|
||||||
* 'path' has been renamed to 'in'
|
* 'path' has been renamed to 'in'
|
||||||
"""
|
"""
|
||||||
inputs = [
|
inputs = [
|
||||||
desc.StringParam(name='in', label='path', description='', value='', uid=[]) # No impact on UID
|
desc.StringParam(name='in', label='path', description='', value='', invalidate=False) # No impact on UID
|
||||||
]
|
]
|
||||||
outputs = [
|
outputs = [
|
||||||
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, uid=[])
|
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, invalidate=False)
|
||||||
]
|
]
|
||||||
|
|
||||||
def test_unknown_node_type():
|
def test_unknown_node_type():
|
||||||
|
|
|
@ -7,11 +7,11 @@ from meshroom.core import desc, registerNodeType
|
||||||
class SampleNode(desc.Node):
|
class SampleNode(desc.Node):
|
||||||
""" Sample Node for unit testing """
|
""" Sample Node for unit testing """
|
||||||
inputs = [
|
inputs = [
|
||||||
desc.File(name='input', label='Input', description='', value='', uid=[0],),
|
desc.File(name='input', label='Input', description='', value='', invalidate=True,),
|
||||||
desc.StringParam(name='paramA', label='ParamA', description='', value='', uid=[]) # No impact on UID
|
desc.StringParam(name='paramA', label='ParamA', description='', value='', invalidate=False) # No impact on UID
|
||||||
]
|
]
|
||||||
outputs = [
|
outputs = [
|
||||||
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, uid=[])
|
desc.File(name='output', label='Output', description='', value=desc.Node.internalFolder, invalidate=False)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -97,8 +97,7 @@ def test_multiviewPipeline():
|
||||||
if attr.isOutput and attr.enabled:
|
if attr.isOutput and attr.enabled:
|
||||||
assert attr.uid() == otherAttr.uid()
|
assert attr.uid() == otherAttr.uid()
|
||||||
else:
|
else:
|
||||||
for uidIndex in attr.desc.uid:
|
assert attr.uid() == otherAttr.uid()
|
||||||
assert attr.uid(uidIndex) == otherAttr.uid(uidIndex)
|
|
||||||
|
|
||||||
# graph4 == graph4b
|
# graph4 == graph4b
|
||||||
nodes, edges = graph4.dfsOnFinish()
|
nodes, edges = graph4.dfsOnFinish()
|
||||||
|
@ -109,8 +108,7 @@ def test_multiviewPipeline():
|
||||||
if attr.isOutput and attr.enabled:
|
if attr.isOutput and attr.enabled:
|
||||||
assert attr.uid() == otherAttr.uid()
|
assert attr.uid() == otherAttr.uid()
|
||||||
else:
|
else:
|
||||||
for uidIndex in attr.desc.uid:
|
assert attr.uid() == otherAttr.uid()
|
||||||
assert attr.uid(uidIndex) == otherAttr.uid(uidIndex)
|
|
||||||
|
|
||||||
# test serialization/deserialization
|
# test serialization/deserialization
|
||||||
for graph in [graph1, graph2, graph3, graph4]:
|
for graph in [graph1, graph2, graph3, graph4]:
|
||||||
|
@ -124,4 +122,4 @@ def test_multiviewPipeline():
|
||||||
# - no compatibility issues
|
# - no compatibility issues
|
||||||
assert all(isinstance(n, Node) for n in loadedGraph.nodes)
|
assert all(isinstance(n, Node) for n in loadedGraph.nodes)
|
||||||
# - same UIDs for every node
|
# - same UIDs for every node
|
||||||
assert sorted([n._uids.get(0) for n in loadedGraph.nodes]) == sorted([n._uids.get(0) for n in graph.nodes])
|
assert sorted([n._uid for n in loadedGraph.nodes]) == sorted([n._uid for n in graph.nodes])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue