Skip to content

Commit a706afa

Browse files
authored
feat(ux): include type of bad value in SignatureValidationError (#10988)
1 parent 7c34888 commit a706afa

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

ibis/common/annotations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def __str__(self):
8888

8989
errors = ""
9090
for name, value, pattern in self.errors:
91-
errors += f"\n `{name}`: {value!r} is not {pattern.describe()}"
91+
errors += f"\n `{name}`: {value!r} of type {type(value)} is not {pattern.describe()}"
9292

9393
sig = f"{self.func.__name__}{self.sig}"
9494
cause = str(self.__cause__) if self.__cause__ else ""
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Example('1', '2', '3', '4', '5', []) has failed due to the following errors:
2-
`a`: '1' is not an int
3-
`b`: '2' is not an int
4-
`d`: '4' is not either None or a float
5-
`e`: '5' is not a tuple of ints
6-
`f`: [] is not coercible to an int
2+
`a`: '1' of type <class 'str'> is not an int
3+
`b`: '2' of type <class 'str'> is not an int
4+
`d`: '4' of type <class 'str'> is not either None or a float
5+
`e`: '5' of type <class 'str'> is not a tuple of ints
6+
`f`: [] of type <class 'list'> is not coercible to an int
77

88
Expected signature: Example(a: int, b: int = 0, c: str = 'foo', d: Optional[float] = None, e: tuple = (1, 2, 3), f: CoercedTo[int] = 1)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Example('1', '2', '3', '4', '5', []) has failed due to the following errors:
2-
`a`: '1' is not an int
3-
`b`: '2' is not an int
4-
`d`: '4' is not either None or a float
5-
`e`: '5' is not a tuple of ints
6-
`f`: [] is not coercible to an int
2+
`a`: '1' of type <class 'str'> is not an int
3+
`b`: '2' of type <class 'str'> is not an int
4+
`d`: '4' of type <class 'str'> is not either None or a float
5+
`e`: '5' of type <class 'str'> is not a tuple of ints
6+
`f`: [] of type <class 'list'> is not coercible to an int
77

88
Expected signature: Example(a: int, b: int = 0, c: str = 'foo', d: Optional[float] = None, e: tuple[int, ...] = (1, 2, 3), f: CoercedTo[int] = 1)
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Literal(1, 4) has failed due to the following errors:
2-
`dtype`: 4 is not coercible to a DataType
2+
`dtype`: 4 of type <class 'int'> is not coercible to a DataType
33

44
Expected signature: Literal(value: Annotated[Any, Not(pattern=InstanceOf(type=<class 'Deferred'>))], dtype: DataType)

0 commit comments

Comments
 (0)