Added new exception [CI SKIP]
parent
0dc1b3ded4
commit
8734cdf180
|
@ -34,3 +34,22 @@ class MissingKeyError(Exception):
|
|||
self.message = "Missing key(s): {}".format(", ".join(keys))
|
||||
|
||||
super().__init__()
|
||||
|
||||
|
||||
class InvalidValueError(Exception):
|
||||
"""Thrown when a key contains an invalid value."""
|
||||
|
||||
def __init__(self, key: str, expected: str, actual: str):
|
||||
"""Create a new InvalidValueError given the arguments.
|
||||
|
||||
Args:
|
||||
key: the key containing the invalid value
|
||||
expected: name of the expected type
|
||||
actual: name of the actual type
|
||||
"""
|
||||
self.message = (
|
||||
f"Invalid value for key {key}: expected {expected}, "
|
||||
f"got {actual}"
|
||||
)
|
||||
|
||||
super().__init__()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Tests wether the skeleton merge works."""
|
||||
from app.skeleton import merge_with_skeleton, MissingKeyError, InvalidKeyError
|
||||
from app.skeleton import merge_with_skeleton
|
||||
from app.exceptions import InvalidKeyError, MissingKeyError
|
||||
import pytest
|
||||
|
||||
|
|
Loading…
Reference in New Issue