Show More
@@ -10,6 +10,9 b' import sys' | |||
|
10 | 10 | import textwrap |
|
11 | 11 | import unittest |
|
12 | 12 | |
|
13 | from importlib.metadata import version | |
|
14 | ||
|
15 | ||
|
13 | 16 | from contextlib import contextmanager |
|
14 | 17 | |
|
15 | 18 | from traitlets.config.loader import Config |
@@ -30,6 +33,9 b' from IPython.core.completer import (' | |||
|
30 | 33 | CompletionContext, |
|
31 | 34 | ) |
|
32 | 35 | |
|
36 | from packaging.version import parse | |
|
37 | ||
|
38 | ||
|
33 | 39 | # ----------------------------------------------------------------------------- |
|
34 | 40 | # Test functions |
|
35 | 41 | # ----------------------------------------------------------------------------- |
@@ -531,7 +537,11 b' class TestCompleter(unittest.TestCase):' | |||
|
531 | 537 | c = next(completions) # should be `%time` or similar |
|
532 | 538 | assert c.type == "magic", "Type of magic was not assigned by completer" |
|
533 | 539 | |
|
534 | @pytest.mark.xfail(reason="Known failure on jedi<=0.18.0") | |
|
540 | @pytest.mark.xfail( | |
|
541 | parse(version("jedi")) <= parse("0.18.0"), | |
|
542 | reason="Known failure on jedi<=0.18.0", | |
|
543 | strict=True, | |
|
544 | ) | |
|
535 | 545 | def test_deduplicate_completions(self): |
|
536 | 546 | """ |
|
537 | 547 | Test that completions are correctly deduplicated (even if ranges are not the same) |
@@ -447,6 +447,11 b' def test_decorator_skip_disabled():' | |||
|
447 | 447 | child.close() |
|
448 | 448 | |
|
449 | 449 | |
|
450 | @pytest.mark.xfail( | |
|
451 | sys.version_info.releaselevel not in ("final", "candidate"), | |
|
452 | reason="fails on 3.13.dev", | |
|
453 | strict=True, | |
|
454 | ) | |
|
450 | 455 | @pytest.mark.skipif(platform.python_implementation() == "PyPy", reason="issues on PyPy") |
|
451 | 456 | @skip_win32 |
|
452 | 457 | def test_decorator_skip_with_breakpoint(): |
@@ -488,7 +488,12 b' def test_pinfo_docstring_if_detail_and_no_source():' | |||
|
488 | 488 | ip._inspect('pinfo', 'foo.bar', detail_level=1) |
|
489 | 489 | |
|
490 | 490 | |
|
491 | def test_pinfo_docstring_dynamic(): | |
|
491 | @pytest.mark.xfail( | |
|
492 | sys.version_info.releaselevel not in ("final", "candidate"), | |
|
493 | reason="fails on 3.13.dev", | |
|
494 | strict=True, | |
|
495 | ) | |
|
496 | def test_pinfo_docstring_dynamic(capsys): | |
|
492 | 497 | obj_def = """class Bar: |
|
493 | 498 | __custom_documentations__ = { |
|
494 | 499 | "prop" : "cdoc for prop", |
@@ -509,20 +514,25 b' def test_pinfo_docstring_dynamic():' | |||
|
509 | 514 | |
|
510 | 515 | ip.run_cell("b = Bar()") |
|
511 | 516 | |
|
512 | with AssertPrints("Docstring: cdoc for prop"): | |
|
513 | ip.run_line_magic("pinfo", "b.prop") | |
|
517 | ip.run_line_magic("pinfo", "b.prop") | |
|
518 | captured = capsys.readouterr() | |
|
519 | assert "Docstring: cdoc for prop" in captured.out | |
|
514 | 520 | |
|
515 | with AssertPrints("Docstring: cdoc for non_exist"): | |
|
516 | ip.run_line_magic("pinfo", "b.non_exist") | |
|
521 | ip.run_line_magic("pinfo", "b.non_exist") | |
|
522 | captured = capsys.readouterr() | |
|
523 | assert "Docstring: cdoc for non_exist" in captured.out | |
|
517 | 524 | |
|
518 | with AssertPrints("Docstring: cdoc for prop"): | |
|
519 | ip.run_cell("b.prop?") | |
|
525 | ip.run_cell("b.prop?") | |
|
526 | captured = capsys.readouterr() | |
|
527 | assert "Docstring: cdoc for prop" in captured.out | |
|
520 | 528 | |
|
521 | with AssertPrints("Docstring: cdoc for non_exist"): | |
|
522 | ip.run_cell("b.non_exist?") | |
|
529 | ip.run_cell("b.non_exist?") | |
|
530 | captured = capsys.readouterr() | |
|
531 | assert "Docstring: cdoc for non_exist" in captured.out | |
|
523 | 532 | |
|
524 | with AssertPrints("Docstring: <no docstring>"): | |
|
525 | ip.run_cell("b.undefined?") | |
|
533 | ip.run_cell("b.undefined?") | |
|
534 | captured = capsys.readouterr() | |
|
535 | assert "Docstring: <no docstring>" in captured.out | |
|
526 | 536 | |
|
527 | 537 | |
|
528 | 538 | def test_pinfo_magic(): |
General Comments 0
You need to be logged in to leave comments.
Login now