X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/2918ea3b079bbb617b2f9f0d5bc0b84fde04e48e..9d5edd302003285b5280e3dd209d6299feafb70e:/tests/test_ipynb.py?ds=sidebyside 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: