From: Marco Edward Gorelli Date: Wed, 13 Apr 2022 23:13:33 +0000 (+0100) Subject: Make ipynb tests compatible with ipython 8.3.0+ (#3008) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/712f8b37fb12a40ec6ea86903f44c2d0750f56a3?ds=inline Make ipynb tests compatible with ipython 8.3.0+ (#3008) --- diff --git a/tests/test_ipynb.py b/tests/test_ipynb.py index b534d77..6f6b309 100644 --- a/tests/test_ipynb.py +++ b/tests/test_ipynb.py @@ -1,3 +1,4 @@ +import contextlib from dataclasses import replace import pathlib import re @@ -18,6 +19,8 @@ from black import Mode from _pytest.monkeypatch import MonkeyPatch from tests.util import DATA_DIR +with contextlib.suppress(ModuleNotFoundError): + import IPython pytestmark = pytest.mark.jupyter pytest.importorskip("IPython", reason="IPython is an optional dependency") pytest.importorskip("tokenize_rt", reason="tokenize-rt is an optional dependency") @@ -139,10 +142,15 @@ def test_non_python_magics(src: str) -> None: format_cell(src, fast=True, mode=JUPYTER_MODE) +@pytest.mark.skipif( + IPython.version_info < (8, 3), + reason="Change in how TransformerManager transforms this input", +) def test_set_input() -> None: src = "a = b??" - with pytest.raises(NothingChanged): - format_cell(src, fast=True, mode=JUPYTER_MODE) + expected = "??b" + result = format_cell(src, fast=True, mode=JUPYTER_MODE) + assert result == expected def test_input_already_contains_transformed_magic() -> None: