Skip to content

Commit 4a0fad1

Browse files
committed
Use assertRaisesRegex instead of assertRaisesRegexp for Python 3.11 compatibility.
1 parent d02419e commit 4a0fad1

File tree

5 files changed

+14
-18
lines changed

5 files changed

+14
-18
lines changed

chart_studio/tests/test_optional/test_grid/test_grid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ def test_duplicate_columns(self):
2727
'the column "{}" and try again.'.format("col_1")
2828
)
2929

30-
with self.assertRaisesRegexp(InputError, expected_message):
30+
with self.assertRaisesRegex(InputError, expected_message):
3131
Grid(df)

chart_studio/tests/test_plot_ly/test_dashboard/test_dashboard.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_invalid_path(self):
2929
"the strings 'first' and 'second'."
3030
)
3131

32-
self.assertRaisesRegexp(PlotlyError, message, dash._insert, my_box, "third")
32+
self.assertRaisesRegex(PlotlyError, message, dash._insert, my_box, "third")
3333

3434
def test_box_id_none(self):
3535

@@ -49,9 +49,7 @@ def test_box_id_none(self):
4949
"one box in your dashboard."
5050
)
5151

52-
self.assertRaisesRegexp(
53-
PlotlyError, message, dash.insert, my_box, "above", None
54-
)
52+
self.assertRaisesRegex(PlotlyError, message, dash.insert, my_box, "above", None)
5553

5654
def test_id_not_valid(self):
5755
my_box = {
@@ -71,12 +69,12 @@ def test_id_not_valid(self):
7169
dash.insert(my_box, "above", 1)
7270

7371
# insert box
74-
self.assertRaisesRegexp(PlotlyError, message, dash.insert, my_box, "above", 0)
72+
self.assertRaisesRegex(PlotlyError, message, dash.insert, my_box, "above", 0)
7573
# get box by id
76-
self.assertRaisesRegexp(PlotlyError, message, dash.get_box, 0)
74+
self.assertRaisesRegex(PlotlyError, message, dash.get_box, 0)
7775

7876
# remove box
79-
self.assertRaisesRegexp(PlotlyError, message, dash.remove, 0)
77+
self.assertRaisesRegex(PlotlyError, message, dash.remove, 0)
8078

8179
def test_invalid_side(self):
8280
my_box = {
@@ -96,7 +94,7 @@ def test_invalid_side(self):
9694
dash = dashboard.Dashboard()
9795
dash.insert(my_box, "above", 0)
9896

99-
self.assertRaisesRegexp(
97+
self.assertRaisesRegex(
10098
PlotlyError, message, dash.insert, my_box, "somewhere", 1
10199
)
102100

chart_studio/tests/test_plot_ly/test_plotly/test_credentials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def test_sign_in_cannot_validate(self):
7878
self.users_current_mock.side_effect = exceptions.PlotlyRequestError(
7979
"msg", 400, "foobar"
8080
)
81-
with self.assertRaisesRegexp(
81+
with self.assertRaisesRegex(
8282
_plotly_utils.exceptions.PlotlyError, "Sign in failed"
8383
):
8484
py.sign_in("foo", "bar")

chart_studio/tests/test_plot_ly/test_plotly/test_plot.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ def test_plot_sharing_invalid_argument(self):
7272

7373
kwargs = {"filename": "invalid-sharing-argument", "sharing": "privste"}
7474

75-
with self.assertRaisesRegexp(
76-
PlotlyError, "The 'sharing' argument only accepts"
77-
):
75+
with self.assertRaisesRegex(PlotlyError, "The 'sharing' argument only accepts"):
7876
py.plot(self.simple_figure, **kwargs)
7977

8078
def test_plot_world_readable_sharing_conflict_1(self):
@@ -87,7 +85,7 @@ def test_plot_world_readable_sharing_conflict_1(self):
8785
"sharing": "public",
8886
}
8987

90-
with self.assertRaisesRegexp(
88+
with self.assertRaisesRegex(
9189
PlotlyError, "setting your plot privacy to both public and private."
9290
):
9391
py.plot(self.simple_figure, **kwargs)
@@ -102,7 +100,7 @@ def test_plot_world_readable_sharing_conflict_2(self):
102100
"sharing": "secret",
103101
}
104102

105-
with self.assertRaisesRegexp(
103+
with self.assertRaisesRegex(
106104
PlotlyError, "setting your plot privacy to both public and private."
107105
):
108106
py.plot(self.simple_figure, **kwargs)

chart_studio/tests/test_plot_ly/test_spectacle_presentation/test_spectacle_presentation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_invalid_style(self):
1919
# one slide
2020
"""
2121

22-
self.assertRaisesRegexp(
22+
self.assertRaisesRegex(
2323
PlotlyError,
2424
chart_studio.presentation_objs.presentation_objs.STYLE_ERROR,
2525
pres.Presentation,
@@ -36,7 +36,7 @@ def test_open_code_block(self):
3636
print x
3737
"""
3838

39-
self.assertRaisesRegexp(
39+
self.assertRaisesRegex(
4040
PlotlyError,
4141
chart_studio.presentation_objs.presentation_objs.CODE_ENV_ERROR,
4242
pres.Presentation,
@@ -52,7 +52,7 @@ def test_invalid_code_language(self):
5252
```
5353
"""
5454

55-
self.assertRaisesRegexp(
55+
self.assertRaisesRegex(
5656
PlotlyError,
5757
chart_studio.presentation_objs.presentation_objs.LANG_ERROR,
5858
pres.Presentation,

0 commit comments

Comments
 (0)