mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-20 16:39:08 +08:00
We raise InvalidContainerError, not KeyError when a container was not found
This commit is contained in:
parent
270cdd08cb
commit
da751fa0ea
@ -446,7 +446,7 @@ def test_setDefinitionByIdExists(global_stack, container_registry):
|
||||
## Tests setting definitions by specifying an ID of a definition that doesn't
|
||||
# exist.
|
||||
def test_setDefinitionByIdDoesntExist(global_stack):
|
||||
with pytest.raises(KeyError):
|
||||
with pytest.raises(InvalidContainerError):
|
||||
global_stack.setDefinitionById("some_definition") #Container registry is empty now.
|
||||
|
||||
## Tests setting definition changes by specifying an ID of a container that
|
||||
@ -457,7 +457,7 @@ def test_setDefinitionChangesByIdExists(global_stack, container_registry):
|
||||
## Tests setting definition changes by specifying an ID of a container that
|
||||
# doesn't exist.
|
||||
def test_setDefinitionChangesByIdDoesntExist(global_stack):
|
||||
with pytest.raises(KeyError):
|
||||
with pytest.raises(InvalidContainerError):
|
||||
global_stack.setDefinitionChangesById("some_definition_changes") #Container registry is empty now.
|
||||
|
||||
## Tests setting materials by specifying an ID of a material that exists.
|
||||
@ -467,7 +467,7 @@ def test_setMaterialByIdExists(global_stack, container_registry):
|
||||
## Tests setting materials by specifying an ID of a material that doesn't
|
||||
# exist.
|
||||
def test_setMaterialByIdDoesntExist(global_stack):
|
||||
with pytest.raises(KeyError):
|
||||
with pytest.raises(InvalidContainerError):
|
||||
global_stack.setMaterialById("some_material") #Container registry is empty now.
|
||||
|
||||
## Tests whether changing the next stack is properly forbidden.
|
||||
@ -522,7 +522,7 @@ def test_setQualityByIdExists(global_stack, container_registry):
|
||||
|
||||
## Tests setting qualities by specifying an ID of a quality that doesn't exist.
|
||||
def test_setQualityByIdDoesntExist(global_stack):
|
||||
with pytest.raises(KeyError):
|
||||
with pytest.raises(InvalidContainerError):
|
||||
global_stack.setQualityById("some_quality") #Container registry is empty now.
|
||||
|
||||
## Tests setting quality changes by specifying an ID of a quality change that
|
||||
@ -533,7 +533,7 @@ def test_setQualityChangesByIdExists(global_stack, container_registry):
|
||||
## Tests setting quality changes by specifying an ID of a quality change that
|
||||
# doesn't exist.
|
||||
def test_setQualityChangesByIdDoesntExist(global_stack):
|
||||
with pytest.raises(KeyError):
|
||||
with pytest.raises(InvalidContainerError):
|
||||
global_stack.setQualityChangesById("some_quality_changes") #Container registry is empty now.
|
||||
|
||||
## Tests setting variants by specifying an ID of a variant that exists.
|
||||
|
Loading…
x
Reference in New Issue
Block a user