Пример #1
0
def test_eldoc():
    """Check eldoc on function with signature."""

    eldoc = anaconda_mode.eldoc(
        '''
def f(obj, fp, skipkeys=False, ensure_ascii=True,
    check_circular=True, allow_nan=True, cls=None,
    indent=None, separators=None, default=None,
    sort_keys=False, **kw):
    pass

f(123
''', 8, 5, None)

    assert eldoc == {
        'name':
        'f',
        'index':
        0,
        'params': [
            'obj', 'fp', 'skipkeys=False', 'ensure_ascii=True',
            'check_circular=True', 'allow_nan=True', 'cls=None', 'indent=None',
            'separators=None', 'default=None', 'sort_keys=False', '**kw'
        ]
    }
Пример #2
0
def test_eldoc_unknown_function():
    """Check eldoc ignore unknown functions."""

    eldoc = anaconda_mode.eldoc('''
unknown_fn(
''', 2, 11, None)

    assert not eldoc
def test_eldoc_unknown_function():
    """Check eldoc ignore unknown functions."""

    eldoc = anaconda_mode.eldoc('''
unknown_fn(
''', 2, 11, None)

    assert not eldoc
def test_eldoc():
    """Check eldoc on function with signature."""

    eldoc = anaconda_mode.eldoc('''
def f(obj, fp, skipkeys=False, ensure_ascii=True,
    check_circular=True, allow_nan=True, cls=None,
    indent=None, separators=None, default=None,
    sort_keys=False, **kw):
    pass

f(123
''', 8, 5, None)

    assert eldoc == {
        'name': 'f',
        'index': 0,
        'params': ['obj', 'fp', 'skipkeys=False', 'ensure_ascii=True',
                   'check_circular=True', 'allow_nan=True', 'cls=None',
                   'indent=None', 'separators=None', 'default=None',
                   'sort_keys=False', '**kw']
    }
Пример #5
0
def test_eldoc():
    """Check eldoc on function with signature."""

    eldoc = anaconda_mode.eldoc(
        """
def f(obj, fp, skipkeys=False, ensure_ascii=True,
    check_circular=True, allow_nan=True, cls=None,
    indent=None, separators=None, default=None,
    sort_keys=False, **kw):
    pass

f(123
""",
        8,
        5,
        None,
    )

    assert eldoc == {
        "name":
        "f",
        "index":
        0,
        "params": [
            "obj",
            "fp",
            "skipkeys=False",
            "ensure_ascii=True",
            "check_circular=True",
            "allow_nan=True",
            "cls=None",
            "indent=None",
            "separators=None",
            "default=None",
            "sort_keys=False",
            "**kw",
        ],
    }