Skip to content

Commit 71e8889

Browse files
[test] Refacto nodeValidators file
1 parent d7f5c95 commit 71e8889

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed
File renamed without changes.

tests/test_attributes.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
from meshroom.core.graph import Graph
2-
import pytest
3-
4-
import logging
5-
logger = logging.getLogger('test')
2+
from tests.utils import registerNodeDesc
3+
from tests.nodes.test.nodeValidators import NodeWithValidators
64

7-
valid3DExtensionFiles = [(f'test.{ext}', True) for ext in ('obj', 'stl', 'fbx', 'gltf', 'abc', 'ply')]
8-
invalid3DExtensionFiles = [(f'test.{ext}', False) for ext in ('', 'exe', 'jpg', 'png', 'py')]
9-
10-
valid2DSemantics= [(semantic, True) for semantic in ('image', 'imageList', 'sequence')]
11-
invalid2DSemantics = [(semantic, False) for semantic in ('3d', '', 'multiline', 'color/hue')]
12-
from tests.nodes.test.validableNode import ValidableNode
135
import pytest
146

157
import logging
@@ -21,6 +13,7 @@
2113
valid2DSemantics= [(semantic, True) for semantic in ('image', 'imageList', 'sequence')]
2214
invalid2DSemantics = [(semantic, False) for semantic in ('3d', '', 'multiline', 'color/hue')]
2315

16+
registerNodeDesc(NodeWithValidators)
2417

2518
def test_attribute_retrieve_linked_input_and_output_attributes():
2619
"""
@@ -57,6 +50,7 @@ def test_attribute_retrieve_linked_input_and_output_attributes():
5750
assert not n0.output.hasOutputConnections
5851
assert len(n0.input.getLinkedInAttributes()) == 0
5952
assert len(n0.output.getLinkedOutAttributes()) == 0
53+
6054
@pytest.mark.parametrize("givenFile,expected", valid3DExtensionFiles + invalid3DExtensionFiles)
6155
def test_attribute_is3D_file_extensions(givenFile, expected):
6256
"""
@@ -75,7 +69,6 @@ def test_attribute_is3D_file_extensions(givenFile, expected):
7569
# Then
7670
assert n0.input.is3D == expected
7771

78-
7972
def test_attribute_i3D_by_description_semantic():
8073
""" """
8174

@@ -114,7 +107,7 @@ def test_attribute_notEmpty_validation():
114107

115108
# Given
116109
g = Graph('')
117-
node = g.addNewNode('ValidableNode')
110+
node = g.addNewNode('NodeWithValidators')
118111

119112
# When
120113
node.mandatory.value = ''
@@ -137,7 +130,7 @@ def test_attribute_range_validation():
137130

138131
# Given
139132
g = Graph('')
140-
node = g.addNewNode('ValidableNode')
133+
node = g.addNewNode('NodeWithValidators')
141134
node.mandatory.value = 'test'
142135

143136
# When

0 commit comments

Comments
 (0)