From 515164cb0634459ed9362806a5abff2467755dbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pacheco?= Date: Thu, 12 Sep 2024 18:24:50 -0400 Subject: [PATCH] fix test_utils.py not to xfail --- tests/test_utils.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index d8d0d6c4..cb1ec05d 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,3 +1,4 @@ +from contextlib import nullcontext import pytest from jwt.utils import force_bytes, from_base64url_uint, is_ssh_key, to_base64url_uint @@ -6,17 +7,18 @@ @pytest.mark.parametrize( "inputval,expected", [ - (0, b"AA"), - (1, b"AQ"), - (255, b"_w"), - (65537, b"AQAB"), - (123456789, b"B1vNFQ"), - pytest.param(-1, "", marks=pytest.mark.xfail(raises=ValueError)), + (0, nullcontext(b"AA")), + (1, nullcontext(b"AQ")), + (255, nullcontext(b"_w")), + (65537, nullcontext(b"AQAB")), + (123456789, nullcontext(b"B1vNFQ")), + (-1, pytest.raises(ValueError)), ], ) def test_to_base64url_uint(inputval, expected): - actual = to_base64url_uint(inputval) - assert actual == expected + with expected as e: + actual = to_base64url_uint(inputval) + assert actual == e @pytest.mark.parametrize(