Skip to content

Commit dde86bb

Browse files
committed
Update ValueErrors in Python 3.14
Signed-off-by: Tomas Pereira de Vasconcelos <tomasvasconcelos1@gmail.com>
1 parent 489958a commit dde86bb

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

tests/unit/color/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ def test_to_rgb(color: Color, expected: str) -> None:
5656
"hex or rgb color, got 'not-a-color' instead",
5757
),
5858
# invalid hex
59-
("#1234567890", ValueError, "too many values to unpack (expected 3)"),
59+
("#1234567890", ValueError, "too many values to unpack (expected 3"),
6060
("#ABCDEFGHIJ", ValueError, "invalid literal for int() with base 16"),
6161
# invalid rgb
6262
("rgb(0,0,999)", PlotlyError, "rgb colors tuples cannot exceed 255"),
6363
# invalid tuple
6464
((1, 2), ValueError, "not enough values to unpack (expected 3, got 2)"),
65-
((1, 2, 3, 4), ValueError, "too many values to unpack (expected 3)"),
65+
((1, 2, 3, 4), ValueError, "too many values to unpack (expected 3"),
6666
],
6767
)
6868
def test_to_rgb_fails_for_invalid_color(

tests/unit/test_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import re
34
from itertools import product
45
from typing import TYPE_CHECKING, TypeVar
56

@@ -31,7 +32,7 @@ def test_raise_for_empty_sequence(self) -> None:
3132

3233
def test_raise_for_non_2d_array(self) -> None:
3334
# Fails if one of the arrays is not 2D
34-
with pytest.raises(ValueError, match=r"too many values to unpack \(expected 2(, got 3)?\)"):
35+
with pytest.raises(ValueError, match=re.escape(r"too many values to unpack (expected 2")):
3536
get_xy_extrema(
3637
densities=[
3738
# valid 2D trace

0 commit comments

Comments
 (0)