diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 99f74864c872..14981df8d4f8 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -824,8 +824,9 @@ def __getitem__(self, key): def __repr__(self): class_name = self.__class__.__name__ indent = len(class_name) + 1 - repr_split = pprint.pformat(dict(self), indent=1, - width=80 - indent).split('\n') + with cbook._suppress_matplotlib_deprecation_warning(): + repr_split = pprint.pformat(dict(self), indent=1, + width=80 - indent).split('\n') repr_indented = ('\n' + ' ' * indent).join(repr_split) return '{}({})'.format(class_name, repr_indented) diff --git a/lib/matplotlib/tests/test_style.py b/lib/matplotlib/tests/test_style.py index 0fd141aec647..552b87e4aa14 100644 --- a/lib/matplotlib/tests/test_style.py +++ b/lib/matplotlib/tests/test_style.py @@ -145,7 +145,7 @@ def test_alias(equiv_styles): rc_dicts = [] for sty in equiv_styles: with style.context(sty): - rc_dicts.append(dict(mpl.rcParams)) + rc_dicts.append(mpl.rcParams.copy()) rc_base = rc_dicts[0] for nm, rc in zip(equiv_styles[1:], rc_dicts[1:]):