From f4f2daab685bc8dd3faeba33e44741f7db6ab1d6 Mon Sep 17 00:00:00 2001 From: Sebastian Bank Date: Wed, 28 Feb 2024 16:01:36 +0100 Subject: [PATCH] fix incorrect `DeprecationWarning` expectation on `.render()` with 3 positional arguments - fix #215 - follow-up 99b4e628ad7407b6e7bb01fb9003956a1a296006 --- tests/backend/test_rendering.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/backend/test_rendering.py b/tests/backend/test_rendering.py index 29c7a85515..348af38bbf 100644 --- a/tests/backend/test_rendering.py +++ b/tests/backend/test_rendering.py @@ -1,3 +1,4 @@ +import contextlib import pathlib import os import shutil @@ -35,8 +36,12 @@ def test_render_missing_file(quiet, engine='dot', format_='pdf'): graphviz.RequiredArgumentError, r'without renderer'), (['dot', 'ps', 'nonfilepath', 'ps', ''], ValueError, r'unknown formatter')], ids=lambda x: getattr(x, '__name__', x)) -def test_render_unknown_parameter_raises(args, expected_exception, match): - with pytest.raises(expected_exception, match=match), pytest.deprecated_call(): +def test_render_unknown_parameter_raises(args, expected_exception, match, + supported_number=3): + checker = (pytest.deprecated_call(match=rf'{supported_number:d} positional args') + if len(args) > supported_number + else contextlib.nullcontext()) + with pytest.raises(expected_exception, match=match), checker: graphviz.render(*args)