Exemplo n.º 1
0
def test_add_doc_missing_name() -> None:
    method = _parse_signature(1, b': c f')
    _add_doc(method, b'@p1: Char. @p2: Float.')

    assert method['name'] == 'method1'
    assert method['doc'] == ''
    assert method['parameters'][0]['name'] == 'arg0'
Exemplo n.º 2
0
def test_add_doc_missing_parameter() -> None:
    method = _parse_signature(1, b': c f')
    _add_doc(method, b'name: Test. @p1: Char')

    assert method['name'] == 'name'
    assert method['parameters'][0]['name'] == 'p1'
    assert method['parameters'][1]['name'] == 'arg1'
Exemplo n.º 3
0
def test_add_doc_basic() -> None:
    method = _parse_signature(1, b'i: c f')
    _add_doc(method, b'name: Test. @p1: Char. @p2: Float. @return: Int.')

    assert method['name'] == 'name'
    assert method['doc'] == 'Test.'
    assert method['parameters'][0]['name'] == 'p1'
    assert method['parameters'][0]['doc'] == 'Char.'
    assert method['parameters'][1]['name'] == 'p2'
    assert method['parameters'][1]['doc'] == 'Float.'
    assert method['return']['doc'] == 'Int.'