mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-02 19:43:57 -06:00
Add test for preferred material diameter mismatch
Done during Turbo Testing and Tooling.
This commit is contained in:
parent
93e397a0cc
commit
9b6443c2d3
1 changed files with 9 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
# Copyright (c) 2019 Ultimaker B.V.
|
# Copyright (c) 2019 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import collections # For OrderedDict to ensure that the first iteration of preferred material is dependable.
|
||||||
from unittest.mock import patch, MagicMock
|
from unittest.mock import patch, MagicMock
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
@ -159,4 +160,11 @@ def test_preferredMaterialDiameter(empty_variant_node):
|
||||||
"preferred_material_correct_diameter": MagicMock(getMetaDataEntry = lambda x: 3) # Correct approximate diameter.
|
"preferred_material_correct_diameter": MagicMock(getMetaDataEntry = lambda x: 3) # Correct approximate diameter.
|
||||||
}
|
}
|
||||||
|
|
||||||
assert empty_variant_node.preferredMaterial(approximate_diameter = 3) == empty_variant_node.materials["preferred_material_correct_diameter"], "It should match only on the material with correct diameter."
|
assert empty_variant_node.preferredMaterial(approximate_diameter = 3) == empty_variant_node.materials["preferred_material_correct_diameter"], "It should match only on the material with correct diameter."
|
||||||
|
|
||||||
|
def test_preferredMaterialDiameterNoMatch(empty_variant_node):
|
||||||
|
empty_variant_node.materials = collections.OrderedDict()
|
||||||
|
empty_variant_node.materials["some_different_material"] = MagicMock(getMetaDataEntry = lambda x: 3) # This one first so that it gets iterated over first.
|
||||||
|
empty_variant_node.materials["preferred_material_wrong_diameter"] = MagicMock(getMetaDataEntry = lambda x: 2)
|
||||||
|
|
||||||
|
assert empty_variant_node.preferredMaterial(approximate_diameter = 3) == empty_variant_node.materials["some_different_material"], "It should match on another material with the correct diameter if the preferred one is unavailable."
|
Loading…
Add table
Add a link
Reference in a new issue