예제 #1
0
def test_node_is_doc_field_false():
    m = astroid.parse(test_no_doc_field)
    attr = m.body[1].last_child().last_child().value.last_child()
    parent = attr.last_child()
    r = utils.node_is_doc_field(parent)

    assert r is False
예제 #2
0
def test_node_is_doc_field_true():
    m = astroid.parse(test_not_field_method)
    attr = m.body[2].last_child().last_child().value.last_child()
    parent = attr.last_child()
    r = utils.node_is_doc_field(parent)

    assert r is True
예제 #3
0
def test_node_is_doc_field_no_infer(mocker):
    mocker.patch.object(utils, 'safe_infer', Mock(return_value=False))
    m = astroid.parse(test_not_field_method)
    attr = m.body[2].last_child().last_child().value.last_child()
    parent = attr.last_child()
    r = utils.node_is_doc_field(parent)

    assert r is False